我正在设置buildbot以使用iCloud电子邮件地址作为状态目标:
m = mail.MailNotifier(fromaddr="some_icloud_user@me.com",
sendToInterestedUsers=False,
extraRecipients=["some_other_icloud_users@me.com"],
useTls=True, relayhost="smtp.mail.me.com", smtpPort=587,
smtpUser="some_icloud_user@me.com", smtpPassword="some_icloud_password")( iCloud电子邮件设置说明为这里)。
似乎TLS/SSL握手(来自master/twistd.log)有问题:
2014-06-09 00:43:34-0700 [ESMTPSender,client] SMTP Client retrying server. Retry: 1
2014-06-09 00:43:34-0700 [ESMTPSender,client] Unhandled Error
Traceback (most recent call last):
File "/Users/ionut/work/buildbot/sandbox/lib/python2.7/site-packages/Twisted-14.0.0-py2.7-macosx-10.9-intel.egg/twisted/internet/tcp.py", line 214, in doRead
return self._dataReceived(data)
File "/Users/ionut/work/buildbot/sandbox/lib/python2.7/site-packages/Twisted-14.0.0-py2.7-macosx-10.9-intel.egg/twisted/internet/tcp.py", line 220, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/Users/ionut/work/buildbot/sandbox/lib/python2.7/site-packages/Twisted-14.0.0-py2.7-macosx-10.9-intel.egg/twisted/protocols/basic.py", line 571, in dataReceived
why = self.lineReceived(line)
File "/Users/ionut/work/buildbot/sandbox/lib/python2.7/site-packages/Twisted-14.0.0-py2.7-macosx-10.9-intel.egg/twisted/mail/smtp.py", line 1063, in lineReceived
why = self._okresponse(self.code,'\n'.join(self.resp))
--- <exception caught here> ---
File "/Users/ionut/work/buildbot/sandbox/lib/python2.7/site-packages/Twisted-14.0.0-py2.7-macosx-10.9-intel.egg/twisted/mail/smtp.py", line 1411, in esmtpState_starttls
self.transport.startTLS(self.context)
exceptions.AttributeError: 'Client' object has no attribute 'startTLS'
2014-06-09 00:43:34-0700 [ESMTPSender,client] Unhandled error in Deferred:
2014-06-09 00:43:34-0700 [ESMTPSender,client] Unhandled Error
Traceback (most recent call last):
Failure: twisted.mail.smtp.TLSError: 451 Could not complete the SSL/TLS handshake
<<< 250-NO-SOLICITING
<<< 250 SIZE 28311552
>>> STARTTLS
<<< 220 2.5.0 Go ahead with TLS negotiation.注意:我无法通过"mail“或"sendmail”从命令行发送电子邮件,因为我注意到buildbot有自己的电子邮件客户端Python代码。
请帮忙-谢谢!
发布于 2014-06-14 08:09:11
解决了这个问题:由于buildbot使用了virtualenv,所以我需要通过easy_install安装easy_install--在包含本地python的目录(即“沙盒”)中运行"easy_install pyopenssl“,并且SSL握手正确进行,因此buildbot现在可以发送电子邮件了。最初,我通过从中链接到SSL目录来“安装”pyOpenSSL。看起来buildbot安装脚本没有安装pyOpenSSL,很奇怪。谢谢!
发布于 2014-06-09 19:52:07
随着现在所有的反垃圾邮件措施到位,直接向收件人的邮件服务器发送邮件的策略不太可能奏效。您最好使用组织的SMTP服务器。
撇开这点不说,我怀疑这里的问题是你没有安装墓穴,或者使用的是不支持TLS的扭曲反应堆。
https://stackoverflow.com/questions/24116105
复制相似问题