import smtplib from email.mime.text import MIMEText from email.utils import formataddr msg = MIMEText(‘邮件内容‘, ‘plain‘, ‘utf-8‘) msg[‘From‘] = formataddr(["武沛齐",‘[email protected]‘]) msg[‘To‘] = formataddr(["走人",‘[email protected]‘]) msg[‘Subject‘] = "主题" server = smtplib.SMTP("smtp.126.com", 25) server.login("[email protected]", "邮箱密码") server.sendmail(‘[email protected]‘, [‘[email protected]‘,], msg.as_string()) server.quit()
时间: 2024-10-17 21:47:03