1
我把从烧瓶邮箱电子邮件,但自从尝试使用在namecheap或BlueHost的邮件服务器中,我发现了以下错误:所以现在从Python中发送电子邮件扔SSLError“未知协议”
SSLError: [Errno 1] _ssl.c:510: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
我正在尝试发送电子邮件,但没有收到邮箱,但仍然收到同样的错误。任何修复? 我的代码如下:
from smtplib import SMTP
smtp = SMTP()
smtp.set_debuglevel(debuglevel)
smtp.connect('xxxxxx', 26)
smtp.login('[email protected]', 'xxxxxxx')
from_addr = "xxx <[email protected]>"
to_addr = [email protected]
subj = "hello"
date = datetime.datetime.now.strftime("%d/%m/%Y %H:%M")
message_text = "Hello\nThis is a mail from your server\n\nBye\n"
msg = "From: %s\nTo: %s\nSubject: %s\nDate: %s\n\n%s" % (from_addr, to_addr, subj, date, message_text)
smtp.sendmail(from_addr, to_addr, msg)
smtp.quit()
我的应用程序在Ubuntu 14.04运行在Amazon EC2上。
谢谢。
smtpd服务是否在您选择的计算机上运行? –