发邮件模块

import yagmail
smtp = yagmail.SMTP(host='smtp.qq.com',user='[email protected]',
password='nzyzcimutivobhgc')
#密码根据不同的邮箱填写,有授权码的邮箱,password填写授权码
smtp.send(to=['[email protected]','[email protected]'],cc='[email protected]',
subject='标题',contents='正文',attachments=r'user.xlsx')
#附件如果不是当前目录,要写上绝对路径,附件中有中文名字,会有乱码,使用牛牛给的插件yagmail插件

猜你喜欢

转载自www.cnblogs.com/lapt/p/11789475.html
今日推荐