當前位置:首頁 » 編程語言 » 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-02-01 14:30:30 瀏覽:785
不良人2無敵傷害腳本 發布:2025-02-01 14:23:04 瀏覽:394
地圖flash源碼 發布:2025-02-01 14:13:33 瀏覽:956
家庭影院配置什麼樣的音響 發布:2025-02-01 14:04:33 瀏覽:545
蘋果手機存儲空間不能用怎麼回事 發布:2025-02-01 14:03:04 瀏覽:258
qq易語言盜號源碼 發布:2025-02-01 14:01:25 瀏覽:812
源神比較好的雲伺服器 發布:2025-02-01 13:55:27 瀏覽:208
黑蘋果idea編譯慢 發布:2025-02-01 13:45:30 瀏覽:551
c和linux 發布:2025-02-01 13:39:38 瀏覽:177
android實現列表 發布:2025-02-01 13:38:06 瀏覽:103