程序发送电子邮件时,我的电子邮件中的主题部分出现时,我遇到了问题。我以为我在跟踪RFC SMTP的插图,但我似乎无法弄清楚我在做什么。非常感激任何帮助。
def email():
sender = [email protected]
receivers = [ [email protected] ]
message = """From: From Admin <[email protected]>
To:To Person <[email protected]>
Subject: Important Information
This is a test email message.
"""
try:
smtpObj = smtplib.SMTP( domain.com , 25)
smtpObj.sendmail(sender, receivers, message)
print "Successfully sent email"
except smtplib.SMTPException:
print( Error: unable to send email )