Autor Beitrag
noctua
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 170



BeitragVerfasst: Mi 22.06.05 00:17 
ich habe so etwas ähnliches wie einen NewsMailer geschrieben, das beudeutet, dass ich e-mail eintragen kann, welche ich in eine .txt speichere und nun habe ich es so gemacht, dass ich einen text eingebe und dieser wird an alle leute in der liste gesendet.

mein problem ist nur, dass ich in meinem code immer auf "senden" klicken musste, um eine mail abzuschicken, da er nur das Fenster mit den entsprechendenen Daten zum senden öffnete. Dies ist zwar einfacher, als jede mail neu zu schreiben , aber das klicken stört doch.

kann man nicht irgendwie gleich mit dem delphi programm mails versenden?

vielleicht habt ihr auch hilfreiche forumeinträge, denn ich hab keine gufunden.


mfg NOc

_________________
Am ende sterben eh alle ................
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 22.06.05 14:50 
Bin mir nicht ganz sicher, was du jetzt genau machen möchtest. :nixweiss: Wenn du mit deinem Delphi-Programm selber die eMails verschicken möchtest, dann würde ich dir empfehlen, dir mal die IdSMTP-Komponente von Indy anzusehen. Wenn du jetzt aber per Outlook deine Mail versendest und nur den Klick auf den "Senden"-Button "emulieren" möchtest, dann kannst du das bestimmt mit einer ProcessMessage machen. ;)
noctua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 170



BeitragVerfasst: Mi 22.06.05 21:17 
Zitat:
Wenn du jetzt aber per Outlook deine Mail versendest und nur den Klick auf den "Senden"-Button "emulieren" möchtest, dann kannst du das bestimmt mit einer ProcessMessage machen.


genau. Ich möchte, dass mein programm eine Mail über (mein)Outlook sendet, ohne, dass ich klicken muss.

_________________
Am ende sterben eh alle ................
noctua Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 170



BeitragVerfasst: Mi 22.06.05 21:28 
im forum steht nicht umbedingt viel über ProcessMessage's hast du vielleicht nen kleinen tip?

_________________
Am ende sterben eh alle ................
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 22.06.05 21:41 
Du solltest eigentlich die Message mit user profile iconMotzi's X-Spy ( :arrow: www.x-spy.net ) "abfangen" können und dann diese in deinem Programm einbauen. Schau einfach mal nach X-Spy. ;)
Marauder
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72



BeitragVerfasst: Mi 22.06.05 22:10 
???

Wie wär's einfach so :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TWinForm1.Button1_Click(sender: System.Object; e: System.EventArgs);
var proc : Process;
begin
//  Process-Objekts:
  proc := Process.Create;
// Parametrieren 
  proc.StartInfo.FileName := 'mailto:abc@blah.com?subject=anfrage&body=blahbla blah';
  proc.Start;
  // oder
  // proc.waitForExit ();
end;


oder so (benötigt die INDY-Componenten, ist aber flexibler...)

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
//
// Sendet Mail an verschiedene Empfänger
//
//

Procedure SendMail (an: Tstringlist; Nachricht: string; Betreff:String);

var
 (*
  an: Tstringlist;       //Enthält die Empfänger E-Mail Adressen
  att1: Tstrings;        //Enthält die Dateipfade zu den Attachments
  Nachricht: RichTextBox;  //Enthält die Mail Nachricht
  vonMail: String;       //Enhält die Absender E-Mail Adresse
  Betreff: String;       //Enhälst den Mail Betreff
  Priority: String;      //Gibt die Mail Priorität an Werte:[mpHighest, mpHigh, mpNormal, mpLow, mpLowest]
  CT: String;            //Content Type des Mails
  SMTPServer: String;    //Zu verwendender SMTP Server
  SMTPUsername: String;  //SMTP Username (meist identisch zu Pop Username)
  SMTPPass: String;      //SMTP Passwort (meist identisch zu Pop Passwort)
  SMTPPort: Integer;     //SMTP Port (25
  SmtpAuthType: Integer; //0=Normal 1=SMTPAuth 2=AfterPop 3=SMPTAuth und AfterPop
  POPServer: String;     //Zu verwendender POP Server
  POPUser: String;       //POP Username
  POPPass: String;       //POP Passwort
  POPPort: Integer;      //POP Port (110)
 *)



  IdMsgSend: TidMessage;
  SMTP: TidSmtp;
  POP: TidPop3;
  i: integer;
  s: string;
  SMTPAuthType : Integer;
  Priority : String;
begin
   Priority :='';
         IdMsgSend := TidMessage.Create(nil);
         SMTP := TidSmtp.Create(nil);
         IdMsgSend.Clear;
         SMTPAuthType := convert.ToInt32(dr.Item ['Auth']);

         // Plain Text
         with TIdText.Create(IdMsgSend.MessageParts, nildo
             begin
                  ContentType := 'text/plain';
                  Body.Text := Nachricht;
             end;

         // HTML Part
         with TIdText.Create(IdMsgSend.MessageParts, nildo
              begin
                   ContentType := 'text/html';
                   Body.Text :=  Nachricht; //Benötigt funktion um RTF zu HTML umzuwandeln
              end;

         with IdMsgSend do
              begin
                   ContentType := '';
                   From.Text := dr.Item ['Absender'].ToString;
                   ReplyTo.EMailAddresses := dr.Item ['Absender'].ToString ;
                   Subject := Betreff;
                   Priority := Priority ;
                   s := '';
                   for i := 0 to an.Count-1 do
                   begin
                        s := s + BccList.EMailAddresses+an.Strings[i] + ';'
                   end;
                   BccList.EMailAddresses := s;
                   ReceiptRecipient.Text := '';
              end;


         IdMsgSend.ContentType := '';

         case SmtpAuthType of
              0: SMTP.AuthType := atNone; //Normal
              1: SMTP.AuthType := atDefault; //SMTPAuth
         end;
         SMTP.Username := dr.Item['SMTPUser'].ToString;
         SMTP.Password := dr.Item['SMTPPWD'].ToString;
         SMTP.Host := dr.Item['SMTPServer'].ToString;
         SMTP.Port := convert.ToInt32 (dr.Item['SMTPPort'].ToString);

         SMTP.Connect;

         Messagebox.Show ('Anzahl Nachrichten zu senden : ' + IntToStr(IdMsgSend.MessageParts.Count));
         try
            SMTP.Send(IdMsgSend);
         finally
            SMTP.Disconnect;
         end;
         IdMsgSend.free;
         SMTP.free;
         POP.free;
     
end;



ACHTUNG ! Ist ein Auszug aus einem meiner Programme, greift für die Felder, wie Absender etc. auf
ein Dataset zu...

Gruß
Herby
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 22.06.05 22:13 
Er möchte kein INDY benutzen und mit deiner Methode da oben öffnet sich nur das Fenster und er muss, wie er beschrieben hat erst noch auf "Senden" klicken. ;)
Marauder
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72



BeitragVerfasst: Mi 22.06.05 22:14 
huaaaaaa...

Immer diese Extrawünsche... :wink:
FFKangoroo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 33

WIN XP SP2
Delphi 7
BeitragVerfasst: Fr 05.05.06 09:22 
user profile iconMarauder hat folgendes geschrieben:
???

Wie wär's einfach so :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TWinForm1.Button1_Click(sender: System.Object; e: System.EventArgs);
var proc : Process;
begin
//  Process-Objekts:
  proc := Process.Create;
// Parametrieren 
  proc.StartInfo.FileName := 'mailto:abc@blah.com?subject=anfrage&body=blahbla blah';
  proc.Start;
  // oder
  // proc.waitForExit ();
end;


...


Was benutzt der denn für einen Komponente?
weil der kennt Systems.object und eventargs nicht.

danke :)

Das FFKangoroo
Marauder
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 72



BeitragVerfasst: Fr 05.05.06 09:30 
Nur .NET ...
Das sind reine .NET Methoden-Parameter, die automatisch eingetragen werden, wenn
man einen Button verwendet.