使用Python SMTP发送邮件
2021/5/25 12:24:41
本文主要是介绍使用Python SMTP发送邮件,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
import smtplib from email.mime.text import MIMEText # 服务器 SMPTserver = "smtp.163.com" # 发送邮件的地址(自己的邮箱地址) sender = "xxxxxx@163.com" # 授权密码(不等同于登录密码) password = "xxxxxxxxxxx" # 发送的文本内容 message = "zhf is a good man" # 转为邮件文本 msg = MIMEText(message) msg["Subject"] = "zhf" msg["From"] = sender # 连接smtp服务器 mailServer = smtplib.SMTP(SMPTserver, 25) # 登录 mailServer.login(sender, password) # 发送邮件 mailServer.sendmail(sender, ["xxxxxxx@qq.com"], msg.as_string()) mailServer.quit()
这篇关于使用Python SMTP发送邮件的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-08有遇到过吗?同样的规则 Excel 中 比Python 结果大
- 2024-03-30开始python成长之路
- 2024-03-29python optparse
- 2024-03-29python map 函数
- 2024-03-20invalid format specifier python
- 2024-03-18pool.map python
- 2024-03-18threads in python
- 2024-03-14python Ai 应用开发基础训练,字符串,字典,文件
- 2024-03-13id3 algorithm python
- 2024-03-13sum array elements python