吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 465|回复: 3
收起左侧

[资源求助] CSDN一篇文章下载

[复制链接]
Eks6666 发表于 2024-6-9 19:59
30吾爱币

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

a3131311026 发表于 2024-6-9 20:22
[Python] 纯文本查看 复制代码
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
 
# 配置邮箱服务器
smtpserver = "smtp.163.com"
 
# 用户/密码
user = "admin@163.com"
password = "123456"
 
# 发送者邮箱
sender = "admin@163.com"
 
# 接收者邮箱
receiver = [ "123456@163.com" , "234567@qq.com" ]
 
# 邮件主题
subject = "Python-email3"
 
msg = MIMEMultipart()
# 多人接收邮件,直接显示下面账号的名字
msg[ 'From' ] = "admin@163.com"
msg[ 'To' ] = "123456@163.com"
msg[ "cc" ] = "234567@qq.com"
msg[ "Subject" ] = Header(subject, "utf-8" )
# 添加正文
msg.attach(MIMEText( '<html><h1>你好!</h1></html>' , "html" , "utf-8" ))
 
# 添加附件
sendFile = open ( "./测试报告.html" , 'rb' ).read()
att = MIMEText(sendFile, "base64" , "utf-8" )
att.add_header( "Content-Type" , "application/octet-stream" )
att.add_header( "Content-Disposition" , "attachment" , filename = "测试报告.html" )
msg.attach(att)
 
if __name__ = = '__main__' :
     smtp = smtplib.SMTP()
     smtp.connect(smtpserver, 25 )
     smtp.login(user, password)
     smtp.sendmail(sender, receiver, msg.as_string())
     smtp.quit()

                        
Joseph_TF 发表于 2024-6-9 20:33
Joseph_TF 发表于 2024-6-13 13:42
Joseph_TF 发表于 2024-6-9 20:33
链接:https://pan.baidu.com/s/1qiChpy9X1trZnHKvjGlFbw
提取码:dgoi

没有问题请尽快结算
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-12-11 20:42

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表