I have a problem sending gmail smtp mail with indy on delphi XE3 build (Version 17.0.4770.56661)
I can smooth send my laptop but other pc's give a error like "connection closed gracefully"
I add a idlogfile component on my form and give me this line
Recv 18.04.2013 11:17:20: 220 mx.google.com ESMTP s47sm13947715eeg.8 - gsmtp<EOL>
Sent 18.04.2013 11:17:20: EHLO S23-101<EOL>
Recv 18.04.2013 11:17:20: 250-mx.google.com at your service, [195.175.87.XX]<EOL>250-SIZE 35882577<EOL>250-8BITMIME<EOL>250-STARTTLS<EOL>250 ENHANCEDSTATUSCODES<EOL>
Sent 18.04.2013 11:17:20: STARTTLS<EOL>
Recv 18.04.2013 11:17:21: 220 2.0.0 Ready to start TLS<EOL>
Sent 18.04.2013 11:17:21: QUIT<EOL>
And I use this code on my app
IdSMTP1.host:='smtp.gmail.com' ;
IdSMTP1.username:='[email protected]';
IdSMTP1.Password:='XXXX';
IdSMTP1.port:=587;
IdSMTP1.UseTLS:=utUseExplicitTLS;
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Mode := sslmClient;
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method:= sslvTLSv1;
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.VerifyDepth := 2;
IdSSLIOHandlerSocketOpenSSL1.SSLOptions.VerifyMode := [];
IdSSLIOHandlerSocketOpenSSL1.Host := IdSMTP1.Host;
IdSSLIOHandlerSocketOpenSSL1.Port := IdSMTP1.Port;
IdMessage1.From.address := '[email protected]';
IdMessage1.CClist.EMailAddresses:= edit5.Text;
IdMessage1.Subject:= 'Subject is here';
IdMessage1.Body.Clear;
Idmessage1.Body.Add('Body is here');
for Z := 0 to ListBox8.Items.Count-1 do begin
TIdAttachmentFile.Create(IdMessage1.MessageParts,ListBox8.Items[Z]);
end;
IdSMTP1.Connect;
IdSMTP1.Authenticate;
try
try
idSMTP1.Send(IdMessage1);
except on E:Exception do
Memo1.Lines.Insert(0, 'ERROR: ' + E.Message);
end;
finally
if idSMTP1.Connected then idSMTP1.Disconnect;
end;
Please help me
Thanks :)