""" author:少校 create Time:2025/2/24 14:52 越努力越幸运 """ from email.mime.image import MIMEImage from smtplib import SMTP_SSL from email.mime.multipart import MIMEMultipart #邮件类 from email.header import Header #邮件主题 from email.mime.text import MIMEText #正文类 connect = SMTP_SSL("smtp.qq.com","465") connect.login("85444652@qq.com","eueysxwzzfncbhab") mail = MIMEMultipart() mail["subject"] = Header("超文本内容","utf-8").encode() mail["to"] = "99928838@qq.com" mail["from"] = "shaoxiao<85444652@qq.com>" #=========================超文本内容============================ #1.打开邮件内容对应的html文件 html_data = open("files/12306.html","r",encoding="utf-8").read() #2.创建正文对象 text = MIMEText(html_data,"html","utf-8") mail.attach(text) #============================================================== connect.sendmail("85444652@qq.com","99928838@qq.com",mail.as_string()) connect.quit()
04.发送超文本邮件
本节893字2025-02-24 17:34:22