我正在使用smtplib
发送邮件,但邮件既没有发送也没有收到错误。代码如下:
import smtplib
import textwrap
from email.mime.text import MIMEText
msg = {}
msg['From'] = 'me@mydomain.me'
msg['To'] = 'yours@gmail.com'
msg['Subject'] = "This is TEST"
TEXT = 'HAY BUDDY'
server = smtplib.SMTP('mail.mydomain.me', 26)
server.login("user@mydomain.me", "xxx")
message = textwrap.dedent("""\
From: %s
To: %s
Subject: %s
%s
""" % (msg['From'], msg['To'], msg['Subject'], TEXT))
print(message)
server.sendmail(msg['From'], msg['To'], message)
server.quit()