AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi: E-Mail-Versand / E-Mail-Formatierung
Thema durchsuchen
Ansicht
Themen-Optionen

Delphi: E-Mail-Versand / E-Mail-Formatierung

Ein Thema von SvenLittkowski · begonnen am 30. Jan 2011 · letzter Beitrag vom 7. Feb 2011
Antwort Antwort
Seite 3 von 5     123 45      
2. Feb 2011, 05:36
Dieses Thema wurde am "02. Feb 2011, 06:36 Uhr" von "mkinzler" aus dem Forum "Algorithmen, Datenstrukturen und Klassendesign" in das Forum "Netzwerke" verschoben.
SvenLittkowski

Registriert seit: 18. Dez 2004
98 Beiträge
 
#22

AW: Delphi: E-Mail-Versand / E-Mail-Formatierung

  Alt 2. Feb 2011, 17:28
Weitere Hilfe durchaus nicht wenig willkommen.
  Mit Zitat antworten Zitat
SvenLittkowski

Registriert seit: 18. Dez 2004
98 Beiträge
 
#23

AW: Delphi: E-Mail-Versand / E-Mail-Formatierung

  Alt 5. Feb 2011, 17:01
Hi erneut.

Ich habe jetzt folgenden Code zum Senden einer E-Mail, doch mein Programm "erstarrt" beim Betätigen des Versandknopfes.

Delphi-Quellcode:
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;
Außerdem benutze ich die Indy-Komponenten "IDMessage" und "IDSMTP".

- 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)?

Geändert von SvenLittkowski ( 6. Feb 2011 um 03:05 Uhr) Grund: Code-Tag durch Delphi-Tag ersetzt
  Mit Zitat antworten Zitat
Mike_

Registriert seit: 26. Mär 2008
98 Beiträge
 
Delphi 2007 Professional
 
#24

AW: Delphi: E-Mail-Versand / E-Mail-Formatierung

  Alt 5. Feb 2011, 19:49
First step:
Check your authentication settings and verify that your gmail account is set up for external sending.

Second step:
Program example
http://www.marcocantu.com/tips/oct06_gmail.html

Otherwise:
I upload a sample GMailSend-Application.
Delphi-Nachwuchs

Geändert von Mike_ ( 5. Feb 2011 um 19:54 Uhr)
  Mit Zitat antworten Zitat
SvenLittkowski

Registriert seit: 18. Dez 2004
98 Beiträge
 
#25

AW: Delphi: E-Mail-Versand / E-Mail-Formatierung

  Alt 5. Feb 2011, 20:04
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.
  Mit Zitat antworten Zitat
SvenLittkowski

Registriert seit: 18. Dez 2004
98 Beiträge
 
#26

AW: Delphi: E-Mail-Versand / E-Mail-Formatierung

  Alt 5. Feb 2011, 20:25
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 von My Delphi 7:
Project MyProgram.exe raised exception class EIdOSSLOCouldNotLoadSSLLibrary with message 'Could not load SSL library.'. Process stopped. Use Step or Run to continue.
And here the complete code:

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.
  Mit Zitat antworten Zitat
Mike_

Registriert seit: 26. Mär 2008
98 Beiträge
 
Delphi 2007 Professional
 
#27

AW: Delphi: E-Mail-Versand / E-Mail-Formatierung

  Alt 5. Feb 2011, 21:25
"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
(Indy hat selbst eine Seite mit den SSL .dll´s)


Update1:
First search result @google:
http://www.google.de/#hl=de&xhr=t&q=...=8&oq=indy+ssl

->

http://www.indyproject.org/Sockets/ssl.en.aspx
Delphi-Nachwuchs

Geändert von Mike_ ( 5. Feb 2011 um 21:29 Uhr)
  Mit Zitat antworten Zitat
SvenLittkowski

Registriert seit: 18. Dez 2004
98 Beiträge
 
#28

AW: Delphi: E-Mail-Versand / E-Mail-Formatierung

  Alt 5. Feb 2011, 21:44
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?
  Mit Zitat antworten Zitat
Mike_

Registriert seit: 26. Mär 2008
98 Beiträge
 
Delphi 2007 Professional
 
#29

AW: Delphi: E-Mail-Versand / E-Mail-Formatierung

  Alt 5. Feb 2011, 21:53
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 http://msdn.microsoft.com/en-us/library/ms682586.aspx.)
Delphi-Nachwuchs
  Mit Zitat antworten Zitat
SvenLittkowski

Registriert seit: 18. Dez 2004
98 Beiträge
 
#30

AW: Delphi: E-Mail-Versand / E-Mail-Formatierung

  Alt 5. Feb 2011, 22:06
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?
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 3 von 5     123 45      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:18 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz