代码改变世界

Python 发邮件

2019-03-24 09:24  JohnRain  阅读(137)  评论(0编辑  收藏  举报

import yagmail
yag = yagmail.SMTP(user='mymail@163.com', password='123123', host='smtp.163.com', port='25')
yag.send(user=='towhom@163.com', subject = "I now can send an attachment", attachments=['a.txt', 'b.jpg'])