I'm having a problem using TidSMTP with TIdSSLIOHandlerSocketOpenSSL getting "Socket Error" just by connecting to the server.
Here's the Form Component Code
object IdSMTP: TIdSMTP
IOHandler = IdSSLIOHandlerSSL
Port = 465
SASLMechanisms = <>
UseTLS = utUseImplicitTLS
Left = 93
Top = 49
end
object IdSSLIOHandlerSSL: TIdSSLIOHandlerSocketOpenSSL
OnStatus = IdSSLIOHandlerSSLStatus
Destination = ':465'
MaxLineAction = maException
Port = 465
DefaultPort = 0
SSLOptions.Mode = sslmUnassigned
SSLOptions.VerifyMode = []
SSLOptions.VerifyDepth = 0
OnStatusInfo = IdSSLIOHandlerSSLStatusInfo
Left = 88
Top = 112
end
and Delphi Code
IdSMTP.Username := 'username';
IdSMTP.Password := 'password';
IdSMTP.Host := 'domain';
IdSMTP.Port := 465;
IdSMTP.UseTLS := utUseImplicitTLS;
try
IdSMTP.Connect;
except
on E:Exception do
// Socket Error, Connection Timeout is thrown.
Memo1.Lines.Add(E.Message);
end;
I logged SSL IO status and got this:
Resolving hostname {domain}.
Connecting to {ip}.
SSL status: "before/connect initialization"
SSL status: "before/connect initialization"
SSL status: "SSLv3 write client hello A"
SSL status: "SSLv3 read server hello A"
Socket Error # 10060
Connection timed out.
Our mail server is using self-signed certificate by the way.
What am i doing wrong?
TIA
UPDATE:07-02-2014
Tried Sending mail to Gmail using Indy tip but i get Connection Closed Gracefully sending the email also after SSLv3 read server hello A.
Resolving hostname smtp.gmail.com.
Connecting to 74.125.25.108.
Connected.
Sending Email..
SSL status: "before/connect initialization"
SSL status: "before/connect initialization"
SSL status: "SSLv3 write client hello A"
SSL status: "SSLv3 read server hello A"
Disconnected.
Connection Closed Gracefully.
Here's the new code:
IdSMTP.Username := 'username';
IdSMTP.Password := 'password';
IdSMTP.Host := 'smtp.gmail.com';
IdSMTP.UseTLS := utUseExplicitTLS;
IdSMTP.Port := 587;
try
// Can connect successfully
IdSMTP.Connect;
// This part throws the exception
IdSMTP.Send(IdMessage);
except
on E:Exception do
// Disconnected, connection closed gracefully
Memo1.Lines.Add(E.Message);
end;
UPDATE:
Tried sending email using Thunderbird connecting to same domain.
Thunderbird:
Indy:
No "client key exchange, ..." occurred on my program.
SOLVED
This isssue was resolved by Manually setting connectiontimeout