當前位置:首頁 » 編程語言 » python郵箱驗證

python郵箱驗證

發布時間: 2023-09-26 01:35:13

python smtp郵件發送失敗怎麼辦

以下代碼調試通過:

#coding:utf-8
importsmtplib
fromemail.mime.textimportMIMEText
fromemail.headerimportHeader

sender='[email protected]'
receiver='[email protected]'
subject='pythonemailtest'
smtpserver='smtp.139.com'
username='[email protected]'
password='xxxxxx'

msg=MIMEText('你好','text','utf-8')#中文需參數『utf-8',單位元組字元不需要
msg['Subject']=Header(subject,'utf-8')

smtp=smtplib.SMTP()
smtp.connect('smtp.139.com')
smtp.login(username,password)
smtp.sendmail(sender,receiver,msg.as_string())
smtp.quit()

運行效果:

熱點內容
加密塊流加密 發布:2025-09-16 15:07:36 瀏覽:695
sqldeveloper導出表 發布:2025-09-16 15:07:33 瀏覽:361
xbox360ftp 發布:2025-09-16 14:45:34 瀏覽:847
火車站附近wifi密碼是多少 發布:2025-09-16 14:45:30 瀏覽:190
國家標准加密 發布:2025-09-16 14:45:27 瀏覽:949
php集成支付寶 發布:2025-09-16 14:05:28 瀏覽:718
php的pregmatchall 發布:2025-09-16 14:04:43 瀏覽:437
片上緩存區 發布:2025-09-16 13:49:18 瀏覽:153
查驗技巧腳本 發布:2025-09-16 13:41:59 瀏覽:727
安卓如何讓應用隱藏 發布:2025-09-16 13:28:58 瀏覽:341