#需发送的数据
data
import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr
from email.mime.multipart import MIMEMultipart
from email.header import Header
#发件箱
my_sender='~'
#密码
my_pass = '~'
#收件箱
my_user=['email1','email12'] # 收件人邮箱账号
#邮件正文数据
mail_content=data.to_html(index=True,justify='left')
msg=MIMEText(mail_content,'html','utf-8')
#发件人姓名,即邮件显示名称
msg['From']=formataddr(["~~~~",my_sender])
msg['To']=";".join(my_user)
#邮件主题
msg['Subject']="***"
server=smtplib.SMTP_SSL("smtp.exmail.qq.com", 465)
server.login(my_sender,my_pass)
server.sendmail(msg['From'],msg['To'].split(';'),msg.as_string())
server.quit()