from email.mime.text import MIMEText
import smtplib
user = “发件人的邮箱”
pwd = “STMP码”
to =“收件人的邮箱”
#邮件正文的内容
msg = MIMEText(“测试的邮件哈哈哈”)
#设置邮件的主题,发件人,收件人
msg[“Subject”] = “一个简简单单的主题”
msg[“From”] = user
msg[“To”] = to
#发送邮件
s = smtplib.SMTP_SSL(“smtp.qq.com” , 465)
s.login(user , pwd)
s.send_message(msg)
s.quit()
print(“success”)