Reputation: 7388
I'm having this 'Socket Error 10060 - Connection timed out' when trying to send emails using TIDSMTP, on a Delphi XE application. The same code works on a Delphi 2007 application on the same machine. No firewalls or anti-virus software installed. Same DLLs used on both applications (libeay32.dll / ssleay32.dll).
Here is my code :
idsmtp1.host = 'xxxx';
idsmtp1.port = 465;
idsmtp1.username = 'x';
idsmtp1.password = 'x';
with ssl1 do
begin
SSLOptions.Method := sslvTLSv1;
SSLOptions.VerifyMode := [];
SSLOptions.VerifyDepth := 0;
Destination := 'smtp.gmail.com:465';
host := 'smtp.gmail.com';
//OnStatusInfo := ssl1statusinfo;
end;
idsmtp1.iohandler := ssl1;
idsmtp1.usetls := utUseImplicitTLS;
idsmtp1.UseEhlo := true;
idsmtp1.connect; // here the exception is throw
Upvotes: 3
Views: 4667
Reputation: 7388
I don't know why, but adding some 'pause' in the event 'onStatusInfo' of TIdSSLIOHandlerSocketOpenSSL fixed the problem. Here is the code added :
procedure ssl1StatusInfo(Msg: string);
begin
sleep(500);
application.processmessages;
end;
Without this code i always got the 'Socket Error 10060 - Connection timed out'.
Upvotes: 1