Buildbot(来自buildbot.net): iCloud电子邮件不作为状态目标工作



我正在设置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/twist .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代码。

请帮忙-谢谢!

随着所有反垃圾邮件措施到位,直接向收件人的邮件服务器发送邮件的策略不太可能很好地工作。您最好使用您组织的SMTP服务器。

除此之外,我怀疑这里的问题是您没有安装pycrypto,或者正在使用不支持TLS的Twisted reactor。

解决了:由于buildbot使用virtualenv,我需要通过easy_install -在包含本地python env的目录中安装pyOpenSSL(即"sandbox"),我运行"easy_install pyOpenSSL"并且SSL握手正确进行,因此buildbot现在可以发送电子邮件。最初,我通过从系统Python框架内部链接到SSL目录来"安装"pyOpenSSL。看起来buildbot安装脚本不安装pyOpenSSL,奇怪。

相关内容

最新更新