我想診斷爲什麼通過Amazon SES發送電子郵件不通過python工作。亞馬遜SES SMTP Python使用
以下示例演示了此問題,其中user
和pass
設置爲適當的憑據。
>>> import smtplib
>>> s = smtplib.SMTP_SSL("email-smtp.us-east-1.amazonaws.com", 465)
>>> s.login(user, pw)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/smtplib.py", line 549, in login
self.ehlo_or_helo_if_needed()
File "/usr/lib/python2.6/smtplib.py", line 510, in ehlo_or_helo_if_needed
(code, resp) = self.helo()
File "/usr/lib/python2.6/smtplib.py", line 372, in helo
(code,msg)=self.getreply()
File "/usr/lib/python2.6/smtplib.py", line 340, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed
此消息不是特別有用,並嘗試其他vraiations,但似乎無法使其工作。
我可以用這些設置使用我的thunderbird電子郵件客戶端發送電子郵件,所以我的假設是我的使命與TLS相關。