發(fā)送郵件的Python文件

 

 

 

import smtplib,sys from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.header import Header def send_my_mail(subject,body,img): form_addr=”你的郵箱@163.com” my_fassword=\\\’你的郵箱密碼\\\’ to_addr=[“你要發(fā)送的郵箱@qq.com”] msg=MIMEMultipart() msg[\\\’From\\\’]=Header(form_addr) msg[\\\’To\\\’]=Header(“你要發(fā)送的郵箱@qq.com”) msg[\\\’Subject\\\’]=Header(subject,”utf-8″) body=MIMEText(body,\\\’plain\\\’,\\\’utf-8\\\’) msg.attach(body) try: att1=MIMEText(open(img,\\\’rb\\\’).read(),\\\’base64\\\’,\\\’utf-8\\\’) except Exception as e: return \\\’file not found\\\’ att1[\\\’Content-Type\\\’]=\\\’application/octet-stream\\\’ att1[\\\’Content-Disposition\\\’]=\\\’attachment;filename=%s\\\’%img msg.attach(att1) try: smtpobj=smtplib.SMTP() smtpobj.connect(\\\’smtp.163.com\\\’) smtpobj.login(form_addr,my_fassword) smtpobj.sendmail(form_addr,to_addr,msg.as_string()) # print(\\\’succeed\\\’) return \\\’succeed\\\’ except Exception as e: print(str(e)) return \\\’failure\\\’
如果,你對(duì)上面的內(nèi)容還有疑問(wèn),推薦選擇西部數(shù)碼企業(yè)云郵箱!有專人協(xié)助您解答郵箱疑問(wèn)。

西部數(shù)碼優(yōu)質(zhì)企業(yè)郵箱服務(wù)商,提供安全穩(wěn)定,簡(jiǎn)單易用,高性價(jià)比的企業(yè)郵箱。按需自由定制,不限空間,極速收發(fā),能夠滿足用戶對(duì)企業(yè)郵箱的不同需求。多種反垃圾郵件算法,99.9%精準(zhǔn)度,智能過(guò)濾,減少垃圾郵件干擾。支持小程序收發(fā)郵件,隨時(shí)隨地移動(dòng)辦公。而且價(jià)格實(shí)惠,還可以免費(fèi)試用,7×24小時(shí)專業(yè)團(tuán)隊(duì)服務(wù)支持!

高性價(jià)比企業(yè)郵箱開通鏈接:http://bingfeng168.cn/services/mail/

贊(0)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享網(wǎng)絡(luò)內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-62778877-8306;郵箱:fanjiao@west.cn。本站原創(chuàng)內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明出處:西部數(shù)碼知識(shí)庫(kù) » Python tkinter多進(jìn)程多線程前郵箱,再用pyinstaller編譯成exe

登錄

找回密碼

注冊(cè)