实用的python工具库

来源链接

点击跳转

1. 邮件发送yagmail

github地址

import yagmail

# gbk使发送的附件在windows电脑上不会出现乱码
yag = yagmail.SMTP(user="EmailAddr", password="EmailPassword", host="SendServer", encoding="gbk")
contents = [
	'This is the body, and here is just text',
	'',  # 邮件内容嵌入图片
	'You can find an audio file attached.',
	"./file.xlsx"  # 字符串对应了一个文件,会成为邮件的附件,如果找不到文件,就是一个普通的字符串
]
yag.send('[email protected]', 'subject', contents)

你可能感兴趣的:(python)