美文网首页
Python库-zmail

Python库-zmail

作者: 早_wsm | 来源:发表于2020-09-07 16:23 被阅读0次

    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)
    

    相关文章

      网友评论

          本文标题:Python库-zmail

          本文链接:https://www.haomeiwen.com/subject/ecllektx.html