发邮件模块

import yagmail
smtp = yagmail.SMTP(host='smtp.qq.com',user='157862589@qq.com',
password='nzyzcimutivobhgc')
#密码根据不同的邮箱填写,有授权码的邮箱,password填写授权码
smtp.send(to=['shenxl@vip.sina.com','158639256@qq.com'],cc='shenxl8078@hotmail.com',
subject='标题',contents='正文',attachments=r'user.xlsx')
#附件如果不是当前目录,要写上绝对路径,附件中有中文名字,会有乱码,使用牛牛给的插件yagmail插件
原文地址:https://www.cnblogs.com/lapt/p/11789475.html