zmail可实现发送邮件与获取你邮件信息的功能
import zmail
subject = "测试zmail发送邮件"
content = "这是通过zmail发送来的邮件"
mail = {
'subject': subject,
'content_text': content,
}
# 发送者邮箱
# 发送者的邮箱
sender = 'xxxxxxxx@qq.com'
# 发送者的邮箱授权码
sender_password = 'xxxxxxxx'
server = zmail.server(sender, sender_password)
# 接收者邮箱
receiver = 'xxxxxxxx@qq.com'
# 开始发送邮件
server.send_mail(receiver, mail)
print('发送成功!')
#server.get_latest()是获取收件箱中最新的一封
mail = server.get_latest()
# for k,v in mail.items():
# print(k,v)
# print(mail['subject'])
# print(mail['content_text'][0])
# aa = zmail.show(mail)
# print(aa)
mail_info = server.get_headers()
print(mail_info)
网友评论