python中yagmail发送邮件模块

import yagmail
username = '[email protected]'
password = 'xxxxx'
smtp = 'smtp.exmail.qq.com'
mail = yagmail.SMTP(user=username,password=password,host=smtp)

to = ['[email protected]']
cc = ['[email protected]']
subject = '发红包!'
content = '发红包!'
files = [r'D:\test\第一课\01.txt',r'D:\test\第一课\02.txt']
mail.send(to=to,cc=cc,subject=subject,contents=content,attachments=files)

你可能感兴趣的:(python3)