I am trying to send an e-mail using gmail account (Delphi 7, Indy 10) with these settings:
TIdSmtp:
Port = 587;
UseTLS := utUseExplicitTLS;
TIdSSLIOHandlerSocketOpenSSL:
SSLOptions.Method := sslvTLSv1;
Everything seems to be set ok. I get this response:
Resolving hostname smtp.gmail.com.
Connecting to 74.125.77.109.
SSL status: "before/connect initialization"
SSL status: "before/connect initialization"
SSL status: "SSLv3 write client hello A"
SSL status: "SSLv3 read server hello A"
SSL status: "SSLv3 read server certificate A"
SSL status: "SSLv3 read server done A"
SSL status: "SSLv3 write client key exchange A"
SSL status: "SSLv3 write change cipher spec A"
SSL status: "SSLv3 write finished A"
SSL status: "SSLv3 flush data"
SSL status: "SSLv3 read finished A"
SSL status: "SSL negotiation finished successfully"
SSL status: "SSL negotiation finished successfully"
Cipher: name = RC4-MD5; description = RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5
; bits = 128; version = TLSv1/SSLv3;
And then it hangs and doesn't finish. E-mail is not sent. What can be the problem?
The problem was simple. I was not patient enough and application didn't hang, there was long timeout. The timeout was result of wrong settings.
yes, i've seen lots of issues with indy10 and tls (generally gmail).
first make sure you have the latest ssl libraries from here
i've seen intermittent stalls and errors that have been resolved in the bleeding edge version of indy (ie. a non-stable release). see http://www.indyproject.org/sockets/download/svn.DE.aspx
for gmail, i generally use implicityTLS on port 465..
idSmtp := TIdSMTP.Create(nil);
try
idSmtp.IOHandler := nil;
idSmtp.ManagedIOHandler := true;
// try to use SSL
try
TIdSSLContext.Create.Free;
idSmtp.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(idSmtp);
if (smtpSettings.port = 465) then
idSmtp.UseTLS := utUseImplicitTLS
else
idSmtp.UseTLS := utUseExplicitTLS;
except
idSmtp.IOHandler.Free;
idSmtp.IOHandler := nil;
end;
if (idSmtp.IOHandler = nil) then
begin
idSmtp.IOHandler := TIdIOHandler.MakeDefaultIOHandler(idSmtp);
idSmtp.UseTLS := utNoTLSSupport;
end;
// send message, etc
finally
idSmtp.Free;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With