代码如下,需要qq邮箱开启授权码
import smtplib from email.mime.text import MIMEText from email.header import Header message = MIMEText('邮件内容') # 邮件内容 message['From'] = Header('[email protected]') # 邮件发送者名字 message['To'] = Header('[email protected]') # 邮件接收者名字 message['Subject'] = Header('邮件主题') # 邮件主题 mail = smtplib.SMTP() mail.connect("smtp.qq.com") # 连接 qq 邮箱 mail.login("[email protected]", "授权码") # 账号和授权码 mail.sendmail("[email protected]", ["[email protected]"], message.as_string()) # 发送账号、接收账号和邮件信息
标签:qq,python,xxx,mail,邮箱,message,com,邮件 From: https://www.cnblogs.com/hd92/p/18022427