中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

Python發(fā)郵件代碼

2018-07-20    來(lái)源:open-open

容器云強(qiáng)勢(shì)上線!快速搭建集群,上萬(wàn)Linux鏡像隨意使用
__author__ = 'administrator'  
# encoding: utf-8  
#!/usr/bin/python  
  
import smtplib  
from email.mime.text import MIMEText  
mailto_list=['xx@qq.com','xx@126.com']  
mail_host="smtp.126.com"  #設(shè)置服務(wù)器  
mail_user="xx@126.com"    #用戶名  
mail_pass="123456"   #口令  
mail_postfix="126.com"  #發(fā)件箱的后綴  
  
def send_mail(to_list,sub,content):  
    me="hello"+"<"+mail_user+"@"+mail_postfix+">"  
    msg = MIMEText(content,_subtype='plain',_charset='utf-8')  
    msg['Subject'] = sub  
    msg['From'] = me  
    msg['To'] = ";".join(to_list)  
    try:  
        server = smtplib.SMTP()  
        server.connect(mail_host)  
        server.login(mail_user,mail_pass)  
        server.sendmail(me, to_list, msg.as_string())  
        server.close()  
        return True  
    except Exception, e:  
        print str(e)  
        return False  
if __name__ == '__main__':  
    if send_mail(mailto_list,"hello","hello world!我是中國(guó)"):  
        print "發(fā)送成功"  
    else:  
        print "發(fā)送失敗"  

標(biāo)簽: 服務(wù)器

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇:使用Javascript設(shè)置,獲取和刪除cookie

下一篇:Android屏幕頁(yè)面的滑動(dòng)切換和抽取父類