发邮件

import yagmail

username = '账号'
password = '授权码'
smtp = 'smtp.163.com'

mail = yagmail.SMTP(user=username,password=password,host=smtp)

to = 'xxxxxx@126.com'
cc = 'aaaaaaa@126.com'
subject = '标题'
content = '内容'
fils = [r'文件绝对路径',r'文件绝对路径']
mail.send(to=to,cc=cc,subject=subject,contents=content,attachments=fils)

 

posted @ 2019-11-15 15:59  灰兔的魔王  阅读(110)  评论(0编辑  收藏  举报