import smtplib
from email.mime.text import MIMEText #邮件正文
from email.header import Header #邮件头
#登录
username = "邮箱1"
password = "邮箱授权码"
smtp_obj = smtplib.SMTP_SSL("smtp.qq.com", 465)
smtp_obj.login(username, password)
#设置邮件内容
msg = MIMEText("hello ","plain","utf-8")
msg["From"] = Header("XXX","utf-8") #发送者
msg["To"] = Header("XXX","utf-8") #接收者
msg["Subject"] = Header("XXX的信","utf-8") #主题
# 发邮件
smtp_obj.sendmail("邮箱1", ["邮箱2","邮箱3"], msg.as_string())