当前位置:首页 » 编程语言 » 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-19 08:57:15 浏览:648
传奇切割机脚本 发布:2025-09-19 08:35:46 浏览:73
博科存储交换机配置 发布:2025-09-19 08:34:31 浏览:137
xp共享win7没有访问权限 发布:2025-09-19 08:29:15 浏览:287
cmd运行python程序 发布:2025-09-19 08:16:07 浏览:297
如何给你的安卓手机正确充电 发布:2025-09-19 08:15:18 浏览:850
vs2010怎么写c语言 发布:2025-09-19 07:31:05 浏览:882
除了证券外还有哪些投资配置 发布:2025-09-19 07:01:48 浏览:89
android把函数 发布:2025-09-19 07:01:04 浏览:295
垃圾站源码 发布:2025-09-19 06:42:30 浏览:168