Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Problem mit INDY, SMTP und SSL (https://www.delphipraxis.net/105987-problem-mit-indy-smtp-und-ssl.html)

fwsp 3. Jan 2008 13:09


Problem mit INDY, SMTP und SSL
 
hallo,

ich versuche per imap mit ssl eine nachricht zu verschicken. leider bekomm ich immer eine fehlermeldung, die ich nicht zuordnen kann. hat jmd eine idee was da falsch läuft?

danke.

Code:
---------------------------
Benachrichtigung über Debugger-Exception
---------------------------
Im Projekt gFTP.exe ist eine Exception der Klasse EIdOSSLConnectError mit der Meldung 'Error connecting with SSL.' aufgetreten.
---------------------------
Anhalten  Fortsetzen  Hilfe  
---------------------------
Delphi-Quellcode:
constructor TgMailFTP.Create(AUsername, APassword: string;
  AStringGrid: TStringGrid; AComboBox: TComboBox);
begin

  FsmtpHost := 'smtp.gmail.com';
  FUsername := AUsername;
  FPassword := APassword;

  FsmtpPort := 587;

  Fsmtp := TIdSMTP.Create;
  Fsmtp.Host := FsmtpHost;
  Fsmtp.Username := FUsername;
  Fsmtp.Password := FPassword;
  Fsmtp.Port := FsmtpPort;
  Fsmtp.AuthType := atDefault;
  Fsmtp.MailAgent := 'Thunderbird 2.0.0.9 (Windows/20071031)';

  Fssl := TIdSSLIOHandlerSocketOpenSSL.Create;
  Fssl.ConnectTimeout := 15000;
  Fssl.SSLOptions.Method := sslvTLSv1;
  Fssl.SSLOptions.Mode := sslmClient;
  Fssl.SSLOptions.VerifyMode := [];
  Fssl.SSLOptions.VerifyDepth := 0;

  Fsmtp.IOHandler := FSSL;
  Fsmtp.UseTLS := utUseImplicitTLS;
end;
Delphi-Quellcode:
procedure TgMailFTP.New(AStr: string; AIsFile: Boolean = True);
var
  Mail: TIdMessage;
begin
  Fssl.Host := FsmtpHost;
  Fssl.Port := FsmtpPort;

  Mail := TIdMessage.Create;
  Mail.From.Address := FUsername;
  Mail.Recipients.EMailAddresses := FUsername;
  Mail.Subject := 'gFTP:' + FPath + AStr + '/|-1';

  try
    try
      Fsmtp.Connect;
      Fsmtp.Send(Mail); //Hier kommt der Fehler
    except
    end;
  finally
    if Fsmtp.Connected then
      Fsmtp.Disconnect;
    Mail.Free;
  end;
end;

fwsp 4. Jan 2008 13:31

Re: Problem mit INDY, SMTP und SSL
 
unauffälliges pushen

fwsp 8. Jan 2008 15:29

Re: Problem mit INDY, SMTP und SSL
 
hat jmd vllt einen funktionierenden code zum thema? ich bin doch net der erste, der das macht^^

generic 9. Jan 2008 08:34

Re: Problem mit INDY, SMTP und SSL
 
du bekommst keine verbindung.

wenn du imap machen willst dann ist das port 143.
wenn du imap-ssl machen willst dann ist das port 993.

deine angabe
Delphi-Quellcode:
FsmtpPort := 587
verwirrt mich.

dein code hat nichts mit imap zutun.
daher:
smtp ist port 25 und smtp-ssl ist port 465.
viele smtp server machen kein smtp-ssl.
eigendlich wird in der praxis eher smtp genutzt welches mit tls geschütz wird.
das läuft dann alles über port 25.

fwsp 9. Jan 2008 09:04

Re: Problem mit INDY, SMTP und SSL
 
die ports mögen dich verwirren, ist aber bei googlemail standard^^ ( http://gmail.google.com/support/bin/...62&topic=12920 ). aber ich werde mal gucken, ob smtp ohne ssl klar kommt. danke für den tipp.

//Edit
ich musste nur auf Fsmtp.UseTLS := utUseExplicitTLS; stellen. jetzt funktioniert es. danke^^

klezmor 26. Mär 2008 23:14

Re: Problem mit INDY, SMTP und SSL
 
ich gebe
Delphi-Quellcode:
smtp.UseTLS := utUseImplicitTLS;
ein und es kommt die fehlermeldung:
Unit1.pas(688): E2003 Undefinierter Bezeichner: 'utUseImplicitTLS'


Alle Zeitangaben in WEZ +1. Es ist jetzt 17:44 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