gpt4 book ai didi

delphi - Indy 10 - 从 GMail 帐户发送消息时 IdSMTP.Send() 挂起

转载 作者:行者123 更新时间:2023-12-03 14:59:10 28 4
gpt4 key购买 nike

我正在尝试使用 gmail 帐户(Delphi 7、Indy 10)通过以下设置发送电子邮件:

TIdSmtp:

Port = 587;
UseTLS := utUseExplicitTLS;

TIdSSLIOHandlerSocketOpenSSL:

SSLOptions.Method := sslvTLSv1;

一切似乎都已确定。我收到这样的回复:

Resolving hostname smtp.gmail.com.
Connecting to 74.125.77.109.
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 certificate A"
SSL status: "SSLv3 read server done A"
SSL status: "SSLv3 write client key exchange A"
SSL status: "SSLv3 write change cipher spec A"
SSL status: "SSLv3 write finished A"
SSL status: "SSLv3 flush data"
SSL status: "SSLv3 read finished A"
SSL status: "SSL negotiation finished successfully"
SSL status: "SSL negotiation finished successfully"
Cipher: name = RC4-MD5; description = RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5
; bits = 128; version = TLSv1/SSLv3;

然后它挂起并且没有完成。电子邮件未发送。可能是什么问题?

最佳答案

是的,我发现 indy10 和 tls(通常是 gmail)有很多问题。

首先确保您拥有最新的 ssl 库 from here

我见过间歇性的停顿和错误,这些问题已在 indy 的前沿版本(即不稳定版本)中得到解决。请参阅http://www.indyproject.org/sockets/download/svn.DE.aspx

对于 gmail,我通常在端口 465 上使用隐式TLS..

  idSmtp := TIdSMTP.Create(nil);
try
idSmtp.IOHandler := nil;
idSmtp.ManagedIOHandler := true;

// try to use SSL
try
TIdSSLContext.Create.Free;
idSmtp.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(idSmtp);
if (smtpSettings.port = 465) then
idSmtp.UseTLS := utUseImplicitTLS
else
idSmtp.UseTLS := utUseExplicitTLS;
except
idSmtp.IOHandler.Free;
idSmtp.IOHandler := nil;
end;

if (idSmtp.IOHandler = nil) then
begin
idSmtp.IOHandler := TIdIOHandler.MakeDefaultIOHandler(idSmtp);
idSmtp.UseTLS := utNoTLSSupport;
end;

// send message, etc

finally
idSmtp.Free;
end;

关于delphi - Indy 10 - 从 GMail 帐户发送消息时 IdSMTP.Send() 挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2145515/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com