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 操作solr索引數(shù)據(jù)的實例詳解
今天小編就為大家分享一篇對python 操作solr索引數(shù)據(jù)的實例詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-12-12使用Python的web.py框架實現(xiàn)類似Django的ORM查詢的教程
這篇文章主要介紹了使用Python的web.py框架實現(xiàn)類似Django的ORM查詢的教程,集成的ORM操作數(shù)據(jù)庫向來是Python最強大的功能之一,本文則探討如何在web.py框架上實現(xiàn),需要的朋友可以參考下2015-05-05python數(shù)據(jù)可視化 – 利用Bokeh和Bottle.py在網(wǎng)頁上展示你的數(shù)據(jù)
本文將展示如何使用python搭建一個網(wǎng)頁應用來展示你的數(shù)據(jù)圖表 很多有關于使用python搭建網(wǎng)頁應用的文章聚焦在如何教讀者搭建一個網(wǎng)頁應用(大多是博客),很多關于使用python做數(shù)據(jù)可視化的文章聚焦在如何教讀者使用python的圖表庫來做可視化2021-10-10