當前位置:首頁 » 編程語言 » 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()

運行效果:

熱點內容
sql臨時視圖 發布:2025-07-03 06:05:30 瀏覽:259
海外Facebook伺服器地址 發布:2025-07-03 06:04:59 瀏覽:513
安卓開發和java開發哪個更吃香 發布:2025-07-03 05:31:09 瀏覽:714
小米怎麼清理微信緩存 發布:2025-07-03 05:28:05 瀏覽:50
代練網站源碼 發布:2025-07-03 05:15:05 瀏覽:740
mrs伺服器更改ip失敗 發布:2025-07-03 04:58:08 瀏覽:830
壓縮柚子 發布:2025-07-03 04:48:16 瀏覽:183
qq和安卓哪個用的人多 發布:2025-07-03 04:31:37 瀏覽:656
日本溥儀訪問 發布:2025-07-03 04:24:27 瀏覽:674
java文件遍歷 發布:2025-07-03 04:22:22 瀏覽:141