【发布时间】:2015-04-17 08:54:15
【问题描述】:
所以我试图利用 Tcl 的 smtp、mime 和 tls 包来允许我的程序通过外部邮件服务器发送电子邮件,例如 gmail 服务器 (smtp.gmail.com) 和 yahoo服务器(smtp.mail.yahoo.com)。我有一个问题出现:
通过 gmail 服务器发送电子邮件给我以下错误:
handshake failed: resource temporarily unavailable
while executing
"::tls::handshake $state(sd)"
我正在使用此处找到的 smtp 信息:http://email.about.com/od/accessinggmail/f/Gmail_SMTP_Settings.htm
我的代码如下所示:
tls::init -tls1 1;
set token [mime::initialize -canonical text/plain -string $body];
mime::setheader $token Subject "Test Email";
smtp::sendmessage $token -recipients "<my email address here>" -servers "smtp.gmail.com" -ports 587 -username "<my other email address here>" -password "<my password here>" -usetls true -debug 1;
mime::finalize $token;
Google 自动向我的 gmail 帐户发送了一封电子邮件,内容如下:
We recently blocked a sign-in attempt to your Google Account <my email here>
它让我可以选择更改“不太安全的应用程序”的安全设置,以允许我的程序使用邮件服务器。所以我做到了,然后我的代码工作得很好。我不明白为什么 gmail 会阻止我发送电子邮件的尝试;为什么它认为我的尝试“不太安全”,从而迫使我在发送电子邮件之前降低电子邮件帐户的安全设置。也许我的理解是错误的,但我相信我正在使用 tls? tls 不是比 ssl 更安全吗?如果我无论如何都无法连接,为什么 gmail 有 tls 端口?
编辑:我也尝试将 tls::init -tls1 1; 更改为 tls::init -ssl3 1; 并使用端口 465 而不是 587,但仍然无济于事。
当我尝试访问 yahoo 邮件服务器时(信息检索自:http://www.serversmtp.com/en/smtp-yahoo),我收到以下错误:
premature end-of-file from server
while executing
"smtp::sendmessage $token -recipients "<my email here>" -servers "smtp.mail.yahoo.com" -ports 465 -username "my other email here" -password "<my password>" -usetls true -debug 1;..."
更新 我了解到,对于 yahoo,您要使用的帐户必须是 Yahoo Mail Plus 帐户才能让您进行 smtp 邮件发送。
【问题讨论】: