我使用下面的脚本向我发送电子邮件,脚本运行正常,没有错误,但我实际上没有收到电子邮件。Python:电子邮件问题
import smtplib
sender = '[email protected]'
receivers = ['[email protected]']
message = """From: From Person <[email protected]>
To: To Person <[email protected]>
Subject: SMTP e-mail test
This is a test e-mail message.
"""
try:
smtpObj = smtplib.SMTP('localhost')
smtpObj.sendmail(sender, receivers, message)
print "Successfully sent email"
except SMTPException:
print "Error: unable to send email"
编辑
脚本就是为什么你使用localhost作为SMTP命名为test.py
如果我身体收到了一封电子邮件,我得有与我的谈话缩水。 – 2010-07-27 19:09:29