邮件

import  smtplib
from email.mime.text import MIMEText
from email.header import Header
smtpserver="smtp.163.com"
user="********"
password="x13525076392"
sender="z*****184@163.com"
receiver="7***986@qq.com"
subject="python email test"
msg = MIMEText('<html><h1>你好是多大的多多多多多多多多多</h1></html>','html','utf-8')#中文需参数‘utf-8’,单字节字符不需要
msg['Subject'] = Header(subject, 'utf-8')


msg['From'] = 'zzq***184@163.com'
msg['To'] = "752397986@qq.com"
smtp = smtplib.SMTP()
smtp.connect('smtp.163.com')
smtp.login(user, password)
smtp.sendmail(sender, receiver, msg.as_string())
smtp.quit()
原文地址:https://www.cnblogs.com/x2x3/p/7605864.html