python学习笔记(五)

时间:2019-06-23 23:55:03   收藏:0   阅读:222

1、发送邮件

import yagmail
username = xxxxx@126.com #邮箱账号
password = xxxxx722123456#邮箱授权码
smtp = smtp.126.com#邮箱服务器地址

mail=yagmail.SMTP(user=username,password=password,host=smtp)#连接邮箱服务器

to=[xxxx@qq.com,xxxx@qq.com]
cc=xxxx@qq.com
subject=交作业
content=test
attach=[rC:\Users\zhang\Desktop\5.jpg,rC:\Users\zhang\Desktop\名单.xlsx]
mail.send(to=to,cc=cc,subject=subject,contents=content,attachments=attach)#发送邮件

 

原文:https://www.cnblogs.com/wmxgreat/p/11074903.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!