使用python发邮件:
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
#定义发送的内容:
msg = MIMEText("你好","plain","utf-8")
#定义邮件标题:
msg['subject'] = "嘿嘿嘿"
#定义发送人的信息:
msg["from"] = formataddr(["zd","zd17338132275@126.com"])
#定义对方的信息:
msg["To"] = formataddr(["zd1","1320685524@qq.com"])
server = smtplib.SMTP_SSL("smtp.126.com","465")
#定义邮箱账户和客户端授权码:
server.login("zd17338132275@126.com","XXX")
#定义自己的邮箱和要发送的邮箱:
server.sendmail("zd17338132275@126.com",["1320685524@qq.com",],msg.as_string())
server.quit()