Autor Beitrag
HenryHux
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 542
Erhaltene Danke: 33

Windows 7 Premium
Delphi XE, Eclipse
BeitragVerfasst: So 23.10.11 09:58 
Hey,

ich versuche eine Mail mit den Indy Komponenten über Gmail zu verschicken.
TLS wird verlangt, kriege ich aber mit den Indys nicht hin.
Exception:
ausblenden Quelltext
1:
2:
Im Projekt Project1.exe ist eine Exception der Klasse EIdSMTPReplyError mit der Meldung 'Must issue a STARTTLS command first. w11sm2090582fad.7
' aufgetreten.


Folgenden Code habe ich bis jetzt:

ausblenden 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:
procedure SendMail;
var
  IdMessage : TIdMessage;
  IdSMTP : TIdSMTP;
begin
  IdMessage := TIdMessage.Create(nil);
  IdSMTP := TIdSMTP.Create(nil);
  try
    with IdSMTP do begin
      Host := 'smtp.googlemail.com';
      Username := 'xxx';
      Password := 'xxx';
      Port := 587;
      AuthType := satDefault;
      //UseTLS = utUseExplicitTLS; //utUseExplicitTLS -> Undeklarierter Bezeichner, beim öffnen der beinhaltenden Unit wird die Unit idSMTP nicht gefunden
    end;
    with IdMessage do begin
      From.Text := 'xxx';
      Sender.Text := From.Text;

      Recipients.EMailAddresses := 'xxx';
      Subject := 'Test';
    end;
    idSMTP.Connect;
    idSMTP.Send(IdMessage);
  finally
    IdMessage.Free;
    IdSMTP.Free;
  end;
end;


Hat jemand einen Tipp?

lg
Stread
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 188

Win 7
Delphi XE
BeitragVerfasst: Di 08.11.11 01:43 
Probiere es mal mit der Indy TIdSSLIOHandlerSocketOpenSSL
und den folgenden Einstellungen.

IdSMTP1 -> AuthType -> atDefault
IdSMTP1 -> IOHandler -> IdSSLIOHandlerSocketOpenSSL1
IdSMTP1 -> UseTLS -> utUseRequireTLS