使用Python SMTP发送邮件
import smtplib
from email.mime.text import MIMEText
# 服务器
SMPTserver = "smtp.163.com"
# 发送邮件的地址(自己的邮箱地址)
sender = "xxxxxx@163.com"
# 授权密码(不等同于登录密码)
password = "xxxxxxxxxxx"
# 发送的文本内容
message = "zhf is a good man"
# 转为邮件文本
msg = MIMEText(message)
msg["Subject"] = "zhf"
msg["From"] = sender
# 连接smtp服务器
mailServer = smtplib.SMTP(SMPTserver, 25)
# 登录
mailServer.login(sender, password)
# 发送邮件
mailServer.sendmail(sender, ["xxxxxxx@qq.com"], msg.as_string())
mailServer.quit()