代码在 Windows 8 上停止运行。它在 Windows7、Windows XP 上运行良好...我找到了解决此问题的方法:在 Windows 兼容模式下启动应用程序:Windows XP (Service Pack 3) - 代码正常工作。如果 Windows 兼容模式为 Windows 7,则代码不起作用。我以管理员身份运行应用程序。已经尝试关闭防病毒和防火墙。我可以使用另一个 smtp 客户端(例如 .Net SmtpClient)发送具有相同参数的电子邮件。该问题在不同的 Windows 8 计算机(家庭、办公室)上重现。我创建了简单的测试应用程序。代码在 Delphi XE、Indy 10.5.7 上编写,OpenSSL 1.0.1.3 dll 放在 test.exe 文件夹中。
有任何想法吗?
代码:
SSLHandler.MaxLineAction := maException;
SSLHandler.SSLOptions.Method := sslvTLSv1;
SSLHandler.SSLOptions.Mode := sslmUnassigned;
SSLHandler.SSLOptions.VerifyMode := [];
SSLHandler.SSLOptions.VerifyDepth := 0;
SSLHandler.OnStatusInfo := IdSSLIOHandlerSocketOpenSSL1StatusInfo;
SMTP.IOHandler := SSLHandler;
SMTP.Host := 'smtp.gmail.com';
SMTP.Port := 587;
SMTP.UseTLS := utUseExplicitTLS;
SMTP.Username := FromAddress;
SMTP.Password := AuthPassword;
Email.From.Address := FromAddress;
Email.Recipients.EmailAddresses := ToAddress;
Email.Subject := Subject;
Email.Body.Text := Body;
SMTP.Connect;
SMTP.Send(Email);
SMTP.Disconnect;
输出:
SSL 状态:“之前/连接初始化”
SSL 状态:“之前/连接初始化”
SSL 状态:“SSLv3 写入客户端 hello A”
SSL 状态:“SSLv3 读取服务器你好 A”
EIdSocketError 与消息“套接字错误 #10060 连接超时。”