数百个Windows 8客户端中大约有2-3个在2-3周前开始收到此消息。
每个Wireshark连接关闭前的最后一次传输是
'2.0.0准备启动TLS'
代码段:
Smtp := TIdSMTP.Create(nil);
try
IdSSLIOHandlerSocketOpenSSL1 := TIdSSLIOHandlerSocketOpenSSL.Create(smtp);
try
Smtp.OnStatus := IdSMTP1Status;
Smtp.OnWorkBegin := IdSMTP1WorkBegin;
Smtp.OnWorkEnd := IdSMTP1WorkEnd;
Smtp.OnWork := IdSMTPWork;
Smtp.Host := 'smtp.gmail.com'
Smtp.Port := 487, 565 both tried here;
Smtp.Username := 'the email@gmail.com'
Smtp.Password := 'The password'
// TLS for Gmail, etc
if UseSSL then // true
begin
Smtp.IOHandler := IdSSLIOHandlerSocketOpenSSL1;
if Smtp.Port = 465 then
Smtp.UseTLS := utUseImplicitTLS
else
if Smtp.Port = 587 then
Smtp.UseTLS := utUseExplicitTLS
else
Smtp.UseTLS := utUseExplicitTLS;
IdSSLIOHandlerSocketOpenSSL1.Host := 'gmail smtp again'
IdSSLIOHandlerSocketOpenSSL1.Destination :=
Smtp.Host + ':' + IntToStr(Smtp.Port);
IdSSLIOHandlerSocketOpenSSL1.Port := Smtp.Port;
end;
try
Smtp.Connect;
sTempFileName := data1.GetSettingsFileFolder+'\tmp.email';
EmailMessage.SaveToFile(sTempFileName);
AssignFile(F,sTempFileName);
Reset(F);
iFileSize := FileSize(F) * 128;
CloseFile(F);
SysUtils.DeleteFile(sTempFileName);
StatusForm.SetProgress(0,iFileSize);
Smtp.Send(EmailMessage);
except on E:Exception do
begin
MessageDlg(E.Message, mtError, [mbOK], 0);
Exit;
end;
end;
finally
IdSSLIOHandlerSocketOpenSSL1.Free;
end;
finally
EmailMessage.MessageParts.Clear;
if Smtp.Connected then smtp.Disconnect;
Smtp.Free;
end;
答案 0 :(得分:7)
2.0.0 Ready to start TLS
以回复STARTTLS
命令。如果您之后立即断开连接,那么TLS握手可能会失败,您应该得到一个异常,解释失败的原因。仔细检查您的TLS设置。另请注意,设置UseTLS
属性可能会更改Port
属性,因此最好在设置UseTLS
之前设置Port
,而不是相反。
此外,您无需设置IOHandler的Host
,Port
或Destination
属性。 Connect()
会为您处理。