zoukankan      html  css  js  c++  java
  • python3发送邮件(yagmail)

    # coding:utf-8

    import yagmail

    # 链接邮箱服务器
    yag = yagmail.SMTP(user="xxx@xx.com", password="xxx!!", host='smtp.xxx.com')

    # 邮箱正文
    contents = ['This is the body, and here is just text http://somedomain/image.png',
    'You can find an audio file attached.', '/local/path/song.mp3','测试邮件']

    # 发送邮件
    yag.send(['xxx@xx.com', 'xxxxxx@xx.com'], '发送附件', contents, ['test.html', 'logo.jpg', 'yagmal_test.txt'])

    #抄送
    # 邮箱正文  文本及附件
    contents = ['This is the body, and here is just text http://somedomain/image.png',
    'You can find an audio file attached.', '/local/path/song.mp3', '测试邮件', 'test.html', 'logo.jpg',
    'yagmal_test.txt']

    # 发送邮件
    yag.send(to='xx@xx.com', cc='xxx@xxx.com', subject='发送附件', contents=contents)
     
  • 相关阅读:
    hdu 1286
    hdu 1420
    hdu 2068
    hdu 1718
    hdu 1231
    hdu 1072
    HDOJ 350留念
    hdu 1898
    hdu 1593
    帮助理解git的图
  • 原文地址:https://www.cnblogs.com/sammy1989/p/8066690.html
Copyright © 2011-2022 走看看