惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
H
Help Net Security
Recorded Future
Recorded Future
The Register - Security
The Register - Security
F
Full Disclosure
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
Security Archives - TechRepublic
Security Archives - TechRepublic
Simon Willison's Weblog
Simon Willison's Weblog
Cisco Talos Blog
Cisco Talos Blog
I
InfoQ
T
Tenable Blog
T
Tor Project blog
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
博客园 - 叶小钗
B
Blog
V
V2EX
Jina AI
Jina AI
L
LangChain Blog
月光博客
月光博客
W
WeLiveSecurity
U
Unit 42
AWS News Blog
AWS News Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 聂微东
V
Visual Studio Blog
A
Arctic Wolf
T
Tailwind CSS Blog
The Cloudflare Blog
SecWiki News
SecWiki News
S
SegmentFault 最新的问题
Hacker News - Newest:
Hacker News - Newest: "LLM"
宝玉的分享
宝玉的分享
MyScale Blog
MyScale Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Securelist
www.infosecurity-magazine.com
www.infosecurity-magazine.com
腾讯CDC
雷峰网
雷峰网

博客园 - 木子东晓东

当androidStudio下载gradle出错时,切换到国内镜像的方法 DevEco Studio 调用hdc的方法 运行Flutter 真机运行安卓报错 将字符串数字转换为薪资类型10000转换为10,000 使用magicAPI对接python 文件,上传参数获取不到回参问题 py集成宝塔,flask已加入模块,无法实现自动发送邮件功能 谷歌浏览器降级的方法-及chromedriver 下载文件 若依框架导入阿里OSS报错问题解决方案 解决若依框架与tailwindcss 样式冲突问题 若依框架前期启动工作 运行若依时报错 MAC 使用docker 启动宝塔 MAC flutter初步学习 2 iOS 审核被拒,日志中找不到苹果返回的creashlog的解决办法 flutter学习之添加第三方应用 MAC flutter初步学习 python Django 连接数据库失败的解决方法 Python之学习菜鸟教程踩的坑 Python学习之环境搭建
使用python 实现自动发送邮件功能,并上传到宝塔
木子东晓东 · 2024-08-14 · via 博客园 - 木子东晓东

def send_qq_mail(subject, content, receiver):

sender = "你的邮箱"

smtpserver = "smtp.qq.com" #使用的是qq邮箱

port = 465 # 端口号

user = '你的邮箱'

password = '授权码' # 请确保这是正确的密码或授权码

《具体去查询qq邮箱授权码》

msg = MIMEText(content, 'plain', 'utf-8') # 发送的文本信息

msg['Subject'] = Header(subject, 'utf-8')

msg['From'] = sender # 应该使用 sender 变量,而不是 user(尽管在这里它们是相同的)

msg['To'] = receiver

try:

# smtp = smtplib.SMTP()

# 在实例化时传入服务器地址和端口号

smtp = smtplib.SMTP_SSL(smtpserver, port)

smtp.login(user, password)

# 注意 receiver 应该是一个列表

smtp.sendmail(sender, [receiver], msg.as_string())

smtp.quit() # 显式关闭连接是一个好习惯

except smtplib.SMTPException:

print("Error: 无法发送邮件")

return ("Error: 无法发送邮件")

 注意事项

1、放行端口号

465端口。不然发送邮件无法连接-宝塔、阿里云

2、不要使用这个方法

# smtp = smtplib.SMTP()

这个方法不加密,会被平台毙掉。无法访问

3、有问题多去查看日志,用gpt读一下日志的问题进行修改