![]() |
Dieses Thema wurde am "02. Feb 2011, 06:36 Uhr" von "mkinzler" aus dem Forum "Algorithmen, Datenstrukturen und Klassendesign" in das Forum "Netzwerke" verschoben.
|
AW: Delphi: E-Mail-Versand / E-Mail-Formatierung
Weitere Hilfe durchaus nicht wenig willkommen. ;-)
|
AW: Delphi: E-Mail-Versand / E-Mail-Formatierung
Hi erneut.
Ich habe jetzt folgenden Code zum Senden einer E-Mail, doch mein Programm "erstarrt" beim Betätigen des Versandknopfes.
Delphi-Quellcode:
Außerdem benutze ich die Indy-Komponenten "IDMessage" und "IDSMTP".
uses
... IdBaseComponent, IdComponent, IdTCPServer, IdSMTPServer, Gradient, IdMessage, IdUDPBase, IdUDPClient, IdSNMP, IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP, idreplysmtp, IdExplicitTLSClientServerBase, IdSMTPBase; ... procedure TEpsilon.ButtonMailClick(Sender: TObject); begin idSMTP.Host:='smtp.googlemail.com'; idSMTP.Port:=465; //smtp service usually runs on this port 25 but GMail wants 465 idSMTP.Password:='MyPassword'; //setup idmessage parameters idmessage.From.address:=EditEMail.Text; idmessage.Recipients.EMailAddresses:='MeinComputerProgram@gmail.com'; idmessage.CCList.EMailAddresses:=''; idmessage.BccList.EMailAddresses:=''; idmessage.Subject:='Mein Computer Program'; idmessage.Body.Text:=EditMailEra.Text+EditMailOld.Text+EditmailAmount.Text+EditMailModern.Text; idmessage.Body.Text:=idmessage.Body.Text+MemoMail.Lines.Text; //send the message try try idSMTP.Connect; LabelStatus.Caption:='Connecting...'; //…then show the message LabelStatus.Hint:='Connecting...'; //…then show the message idSMTP.send(idmessage); LabelStatus.Caption:='Sending...'; //…then show the message LabelStatus.Hint:='Sending...'; //…then show the message //if an exception occurs… except on E: EIdSMTPReplyError do begin LabelStatus.Caption:=E.Message; //…then show the message LabelStatus.Hint:=E.Message; //…then show the message end; end; finally //disconnect from server if IdSMTP.Connected then begin IdSMTP.Disconnect; LabelStatus.Caption:='Disconnecting...'; //…then show the message LabelStatus.Hint:='Disconnecting...'; //…then show the message end; end; end; - GMail will aber auch "My Server requires authentication" haben. Liegt es vieleicht daran? - Und wenn, wie baue ich dies ein? - Was sonst ist eventuell falsch oder Schuld am Erstarren des Programmes? - Wie kann ich laufend die Caption vom StatusLabel den Status anzeigen lassen (beim Erstarren ist es leer)? |
AW: Delphi: E-Mail-Versand / E-Mail-Formatierung
First step:
Check your authentication settings and verify that your gmail account is set up for external sending. Second step: Program example ![]() Otherwise: I upload a sample GMailSend-Application. |
AW: Delphi: E-Mail-Versand / E-Mail-Formatierung
Hey Mike, vielen Dank, der Link scheint mir recht nützlich zu sein. Bitte gebe mir ein paar Minuten, um einige Sachen daraus auszuprobieren. Ich melde mich hier wieder danach.
Hey Mike, thanks a lot, that link seems quite useful to me. Please give me a few minutes to try out some parts of that code. I'll be back here, right after. |
AW: Delphi: E-Mail-Versand / E-Mail-Formatierung
Things I do wrong. I added code excerpts from your linked sample code, but on Execution (yes, it compiled error-free!) I get the following execution-aborting error message:
Zitat:
Code:
implementation
uses Box1; {$R *.dfm} procedure TEpsilon.FormCreate(Sender: TObject); begin Epsilon.Color:=Alpha.ColorDialog.Color; end; procedure TEpsilon.ButtonMailClick(Sender: TObject); begin idSMTP.Host:='smtp.googlemail.com'; idSMTP.Port:=465; //smtp service usually runs on this port 25 idSMTP.Password:='MyPassword'; idSMTP.UseTLS:=utUseExplicitTLS; //setup idmessage parameters idmessage.From.address:=EditEMail.Text; idmessage.Recipients.EMailAddresses:='MyEMail@gmail.com'; idmessage.CCList.EMailAddresses:=''; idmessage.BccList.EMailAddresses:=''; idmessage.Subject:='My E-Mail'; idmessage.Body.Text:=EditMailEra.Text+EditMailOld.Text+EditmailAmount.Text+EditMailModern.Text; idmessage.Body.Text:=idmessage.Body.Text+MemoMail.Lines.Text; //check if receipt confirmation is required // if checkbox1.checked then idmessage.ReceiptRecipient.Text:=edfrom.Text; //if required, set the sendback email address to your email address //send the message try try idSMTP.Connect; LabelStatus.Caption:='Connecting...'; //…then show the message LabelStatus.Hint:='Connecting...'; //…then show the message idSMTP.send(idmessage); LabelStatus.Caption:='Sending...'; //…then show the message LabelStatus.Hint:='Sending...'; //…then show the message //if an exception occurs… except on E: EIdSMTPReplyError do begin LabelStatus.Caption:=E.Message; //…then show the message LabelStatus.Hint:=E.Message; //…then show the message end; end; finally //disconnect from server if IdSMTP.Connected then begin IdSMTP.Disconnect; LabelStatus.Caption:='Disconnecting...'; //…then show the message LabelStatus.Hint:='Disconnecting...'; //…then show the message end; end; end; procedure TEpsilon.ButtonBrowseClick(Sender: TObject); // doesn't function, so I disabled it - for now begin // if OpenDialog.Execute then TIdAttachmentFile.Create(idmessage.MessageParts,OpenDialog.FileName); // AddAttachments; end; (* procedure TEpsilon.AddAttachments; // caused problems, too var li: TListItem; idx: Integer; begin //clear the attachment listview lvAttachments.Items.Clear; //loop through Idmessage and count parts for idx:=0 to Pred(Idmessage.MessageParts.Count) do begin li:=lvAttachments.Items.Add; // Check if Idmessage contains any attachments… if Idmessage.MessageParts.Items[idx] is TIdAttachmentFile then begin //if so, get the file names… li.Caption:=TIdAttachmentFile(Idmessage.MessageParts.Items[idx]).Filename; //and add them to the listview li.SubItems.Add(TIdAttachmentFile(Idmessage.MessageParts.Items[idx]).ContentType); end else begin li.Caption:=Idmessage.MessageParts.Items[idx].ContentType; end; end; end; *) procedure TEpsilon.IdSSLIOHandlerSocketOpenSSLStatusInfo(Msg: String); begin LabelStatus.Caption:=Msg; end; procedure TEpsilon.IdSMTPStatus(ASender: TObject; const AStatus: TIdStatus; const AStatusText: String); begin LabelStatus.Caption:=AStatusText; end; end. |
AW: Delphi: E-Mail-Versand / E-Mail-Formatierung
"Could not load SSL library"
Question: Well, whats the error ? Answer: Could not load SSL library Hehe jetzt mal auf Deutsch :-) Die .dll Dateien fehlen für die SSL Komponente die du benutzt (Aus lizenzrechtlichen Gründe wurde diese nicht mitgeliefert). Schau auf der Indyseite nach oder bei meinen letzten Beiträgen. Es ist von der Indykomponente abhängig, welche SSL .dll du benötigst. Google it :thumb: (Indy hat selbst eine Seite mit den SSL .dll´s) Update1: First search result @google: ![]() -> ![]() |
AW: Delphi: E-Mail-Versand / E-Mail-Formatierung
Also, ich habe jetzt von "http://indy.fulgan.com/SSL" das Archiv "openssl-1.0.0c-i386-win32.zip" heruntergeladen und die die folgenden DLL-Dateien daraus in ein Verzeichnis inenrhalb "Delphi/Source/Indy" extrahiert:
- libeay32.dll - ssleay32.dll Außerdem dabei war noch die folgende Datei, über deren Verwendung ich nichts weiß und sie dehalb nicht ausführe: - openssl.exe Dieses ganze Paket ist mir neu, hatte noch nie damit gearbeitet. Habe ich soweit alles richtig gemacht? Oder (das könnte ich mir fast vorstellen) müssen die DLLs woanders hin, vieleicht zu meiner eigenen Anwendung? |
AW: Delphi: E-Mail-Versand / E-Mail-Formatierung
Windows first searches the directory where the exe is located and does not find the bound dlls. The 2nd place Windows searches for the dlls is in the shared system32 directory.
(This MSDN article describes the Windows search order for dlls ![]() |
AW: Delphi: E-Mail-Versand / E-Mail-Formatierung
Hmm, erneut Danke. :-)
Bedeutet aber auch, wenn ich mein Programm an Leute verteile, daß ich dann auch einen Installer benutzen muß, damit die DLLs an die richtige Stelle kopiert werden, oder? Ich hatte die DLLs im selben Verzeichnis wie die EXE meines Programmes, aber trotzdem der selbe Fehler. Sind dies die korrekten DLLs? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:19 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz