def sendemali(filepath): #??email
from_addr,password,mail_to,mail_body=load_emil_setting()
msg = MIMEMultipart()
msg['Subject'] = '?????????'
msg['From'] ='???????'
msg['To'] = mail_to
msg['Date'] = time.strftime('%a, %d %b %Y %H:%M:%S %z')
att = MIMEText(open(r'%s'%filepath, 'rb').read(), 'base64', 'utf-8')
att["Content-Type"] = 'application/octet-stream'
att["Content-Disposition"] = 'attachment; filename="pyresult.html"'
txt = MIMEText("???????????????",'plain','gb2312')
msg.attach(txt)
msg.attach(att)
smtp = smtplib.SMTP()
server = smtplib.SMTP_SSL("smtp.qq.com",465)
server.login(from_addr, password)
server.sendmail(from_addr, mail_to, msg.as_string())
server.quit()
评论列表
文章目录