yagmail模塊的使用

import yagmail# 連接郵箱服務器yag = yagmail.SMTP(user="xxxxxx@126.com", password="xxxxxx", host='smtp.126.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('389688559@qq.com', 'subject', contents)  # 收件人  郵件標題  郵件內容yag.send(['aa@126.com', 'bb@qq.com', 'cc@gmail.com'], 'subject', contents)  # 多個用戶yag.send('aaaa@126.com', '發送附件', contents, ["d://log.txt", "d://baidu_img.jpg"])  # 發送附件
相關文章
相關標籤/搜索