我想通过GMail服务器发送电子邮件。
TRY
SMTP.Connect; // <---- This is TIdSMTP
EXCEPT
Log.AddError('Cannot connect to the email server.');
END;
if SMTP.Connected then
TRY
SMTP.Send(MailMessage);
EXCEPT
on E:Exception DO
begin
Log.AddError('Connected to server but could not send email!');
Log.AddError(E.Message);
end;
END;
if SMTP.Connected
then SMTP.Disconnect;
这段代码在2014年与Delphi XE一起使用。
程序连接到服务器ok,但最后它说“此服务器上没有SSL”:
Resolving hostname smtp.Gmail.com.
Connecting to 74.125.xxx.xxx
Connected.
Connected to SMTP server...
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 hello A"
Disconnected.
Connected to server but could not send email!
SSL is not available on this server.
我有最新版本的OpenSSL(今天下载)和Delphi XE7 WireShark说:
警报(级别:致命,描述:协议版本)
为什么我无法发送电子邮件?
我尝试了所有:没有TSL,隐式,显式,startTSL ......
答案 0 :(得分:4)
解决方案: sslvTLSv1必须包含在SSLIOHandler.SSLVersions
属性中。