TCL 电子邮件脚本无法在 Activestate TCL 中发送
我在 MAC OSX 版本的 TCL 上运行了以下脚本,它工作正常,但它挂在 Windows 7 机器上的 ActiveState TCL 上。
proc send_simple_message {recipient email_server subject body} {
package require smtp
package require mime
set token [mime::initialize -canonical text/plain -string $body]
mime::setheader $token Subject $subject
smtp::sendmessage $token \
-ports 587 \
-debug 1\
-username [email protected] \
-password myPassword \
-recipients $recipient -servers $email_server
mime::finalize $token
}
send_simple_message [email protected] smtp.gmail.com \
"This is the subject." "This is the message."
您知道 Activestate 系统上可能出现什么问题吗? (这是 Activestate 的全新安装,几天前下载的。)
更新: 我认为由于公司防火墙的原因,它被冻结了(我必须和某人谈谈这个问题。) 然而,虽然我在不通过公司网络时可以走得更远,但它仍然无法传递消息。 我得到以下调试信息:
Trying smtp.gmail.com...
<-- 220 mx.google.com ESMTP d8sm8712528ibl.1
--> EHLO ush10900dv (wait upto 300 seconds)
<-- 250-mx.google.com at your service, [32.178.65.125]
<-- 250-SIZE 35882577
<-- 250-8BITMIME
<-- 250-STARTTLS
<-- 250 ENHANCEDSTATUSCODES
--> STARTTLS (wait upto 300 seconds)
<-- 220 2.0.0 Ready to start TLS
--> EHLO ush10900dv (wait upto 300 seconds)
<-- 250-mx.google.com at your service, [32.178.65.125]
<-- 250-SIZE 35882577
<-- 250-8BITMIME
<-- 250-AUTH LOGIN PLAIN XOAUTH
<-- 250 ENHANCEDSTATUSCODES
--> MAIL FROM:<peddy@ush10900dv> SIZE=245 (wait upto 600 seconds)
<-- 530-5.5.1 Authentication Required. Learn more at
<-- 530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 d8sm8712528ibl.1
--> RSET (wait upto 0 seconds)
--> QUIT (wait upto 0 seconds)
handshake failed: resource temporarily unavailable
while executing
"::tls::handshake $state(sd)"
invoked from within
"smtp::sendmessage $token -ports 587 -debug 1 -username [email protected]
该脚本在 MacOS 计算机和 Windows/Activestate 计算机上使用相同的凭据,但似乎授权失败?还有其他想法吗?
I ran the following script on the MAC OSX version of TCL and it worked fine however it hangs on ActiveState TCL on a Windows 7 machine
proc send_simple_message {recipient email_server subject body} {
package require smtp
package require mime
set token [mime::initialize -canonical text/plain -string $body]
mime::setheader $token Subject $subject
smtp::sendmessage $token \
-ports 587 \
-debug 1\
-username [email protected] \
-password myPassword \
-recipients $recipient -servers $email_server
mime::finalize $token
}
send_simple_message [email protected] smtp.gmail.com \
"This is the subject." "This is the message."
Any ideas what could be wrong on the Activestate system?
(It's a fresh install of Activestate, downloaded it a couple days ago.)
UPDATE:
I think it was freezing due to the corp firewall (I'll have to talk to someone about that.)
HOWEVER While I can get farther when not going through the corp network it still doesn't deliver the message.
I get the following debug info back:
Trying smtp.gmail.com...
<-- 220 mx.google.com ESMTP d8sm8712528ibl.1
--> EHLO ush10900dv (wait upto 300 seconds)
<-- 250-mx.google.com at your service, [32.178.65.125]
<-- 250-SIZE 35882577
<-- 250-8BITMIME
<-- 250-STARTTLS
<-- 250 ENHANCEDSTATUSCODES
--> STARTTLS (wait upto 300 seconds)
<-- 220 2.0.0 Ready to start TLS
--> EHLO ush10900dv (wait upto 300 seconds)
<-- 250-mx.google.com at your service, [32.178.65.125]
<-- 250-SIZE 35882577
<-- 250-8BITMIME
<-- 250-AUTH LOGIN PLAIN XOAUTH
<-- 250 ENHANCEDSTATUSCODES
--> MAIL FROM:<peddy@ush10900dv> SIZE=245 (wait upto 600 seconds)
<-- 530-5.5.1 Authentication Required. Learn more at
<-- 530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 d8sm8712528ibl.1
--> RSET (wait upto 0 seconds)
--> QUIT (wait upto 0 seconds)
handshake failed: resource temporarily unavailable
while executing
"::tls::handshake $state(sd)"
invoked from within
"smtp::sendmessage $token -ports 587 -debug 1 -username [email protected]
The script is using the same credentials on both the MacOS machine and the Windows/Activestate machine, but it seem to be failing authorization? Any further ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
被防火墙阻止(或到达远程计算机端口 tcp/587 时出现一般连接问题)?我将从交互式 tclsh 开始
(推荐tkcon)。您应该在合理的时间内(可能是几秒钟)从远程服务器获取“HELO”字符串。
Blocked by a firewall (or a general connectivity problem with reaching port tcp/587 of the remote machine)? I'd start with
in an interactive tclsh (tkcon is recommended). You should get the "HELO" string from the remote server in a reasonable time (may be a couple of seconds).
您似乎没有尝试进行身份验证。在 Mac 上,您的 Tcl 安装可能包括来自 Tcllib 的 SASL 软件包,但您的 Windows 计算机上可能没有包括它。没有可用的 SASL 并不是一个错误,因为许多人不需要进行身份验证,但您明确需要它。您可以使用
teacup
实用程序将SASL包添加到您的ActiveTcl安装中。teacup install SASL
应该可以做到。该软件包支持 LOGIN 和 PLAIN SASL 机制,这些机制在 TLS 链接上效果很好。It looks like you are not attempting to authenticate. On you Mac, your Tcl installation probably includes the SASL package from Tcllib and you may not have included it on your Windows machine. Not having SASL available is not an error as many people do not have to authenticate but you clearly require it. You can use the
teacup
utility to add the SASL package to your ActiveTcl install.teacup install SASL
should do it. The package supports the LOGIN and PLAIN SASL mechanizms which are fine over a TLS link.我花了几天时间尝试使用身份验证通过 smtp.gmail.com 和本地 MS Exchange 发送电子邮件,但没有成功。我终于设法使用下面的代码让它工作。此过程是使用 pltclu 从 PostgreSQL 运行的。
我希望它至少能帮助一个人。
I spent several days trying to send email through both smtp.gmail.com and my local MS Exchange using authentication but without success. I finally managed to get it working using the code below. This procedure was run from withn PostgreSQL using pltclu.
I hope it helps at least one person.
编辑:
按照 Google 帮助中心中的步骤操作并解锁您的 Gmail。
如果握手问题仍然存在,则似乎是 Tcl 的 TLS 实现,请尝试升级和降级软件包,如果这不起作用,请查看 tclsh.exe 的放置位置或 tcl 的库路径是否为 ssleay32.dll,并告诉我相关信息。
另一个问题,您使用的是 Windows 7 的 x64 发行版吗?
EDIT:
Follow the steps on Google Help Center and unlock your gmail.
If handshake problems persists it seems to be a Tcl's TLS implementation try upgrading and downgrading the package, if that don't work look if where tclsh.exe are placed, or tcl's library path, are a ssleay32.dll, and tell me about that.
another question, are you using a x64 distribution of windows 7?
这可能是因为谷歌安全设置。请转至“https://www.google.com/settings/security/lesssecureapps< /a>”,并确保启用对安全性较低的应用的访问权限。这对我有用。
拉维。
This may be because of google security settings. please go to "https://www.google.com/settings/security/lesssecureapps" and make sure you enable Access for less secure apps. This worked for me.
Ravi.