python實發(fā)郵件實例詳解
更新時間:2019年11月11日 14:35:31 作者:ZibinChen
在本篇文章里小編給大家整理的是關于python實發(fā)郵件的相關知識點內(nèi)容,有需要的朋友們學習下。
yagmail 實現(xiàn)發(fā)郵件
yagmail 可以更簡單的來實現(xiàn)自動發(fā)郵件功能。
1、安裝
pip install yagmail
2、簡單舉例
import yagmail
#鏈接郵箱服務器
yag = yagmail.SMTP( user="user@126.com", password="1234", 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']
# 發(fā)送郵件
yag.send('taaa@126.com', 'subject', contents)
3、給多個用戶發(fā)送郵件
# 發(fā)送郵件 yag.send(['aa@126.com','bb@qq.com','cc@gmail.com'], 'subject', contents)
4、發(fā)送帶附件郵件
# 發(fā)送郵件
yag.send('aaaa@126.com', '發(fā)送附件', contents, ["d://log.txt","d://baidu_img.jpg"])
以上就是本次介紹的關于python實發(fā)郵件的全部相關內(nèi)容,感謝大家的學習和對腳本之家的支持。
相關文章
python使用xlrd和xlwt讀寫Excel文件的實例代碼
這篇文章主要介紹了python使用xlrd和xlwt讀寫Excel文件的實例代碼,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下2018-09-09
CentOS 7下安裝Python 3.5并與Python2.7兼容并存詳解
這篇文章主要給大家介紹了在CentOS 7下安裝Python 3.5并與Python2.7兼容并存的相關資料,文中將安裝步驟介紹的非常詳細,對大家具有一定的參考學習價值,需要的朋友們下面跟著小編來一起學習學習吧。2017-07-07
Pytorch中TensorBoard及torchsummary的使用詳解
這篇文章主要介紹了Pytorch中TensorBoard及torchsummary的使用詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2021-05-05
python計算階乘和的方法(1!+2!+3!+...+n!)
今天小編就為大家分享一篇python計算階乘和的方法(1!+2!+3!+...+n!),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-02-02

