我在 delphi XE3 版本(版本 17.0.4770.56661)上使用 indy 发送 gmail smtp 邮件时遇到问题
我可以顺利发送我的笔记本电脑,但其他电脑会出现“连接正常关闭”之类的错误
我在表单上添加了一个 idlogfile 组件并给了我这一行
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>
我在我的应用程序上使用此代码
IdSMTP1.host:='smtp.gmail.com' ;
IdSMTP1.username:='umutscada@gmail.com';
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 := 'umutscada@gmail.com';
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;
请帮我
谢谢 :)