标签:
1 import smtplib 2 from email.mime.text import MIMEText 3 from email.utils import formataddr 4 5 6 msg = MIMEText(‘邮件内容‘, ‘plain‘, ‘utf-8‘) 7 msg[‘From‘] = formataddr(["武沛齐",‘wptawy@126.com‘]) 8 msg[‘To‘] = formataddr(["走人",‘424662508@qq.com‘]) 9 msg[‘Subject‘] = "主题" 10 11 server = smtplib.SMTP("smtp.126.com", 25) 12 server.login("wptawy@126.com", "邮箱密码") 13 server.sendmail(‘wptawy@126.com‘, [‘424662508@qq.com‘,], msg.as_string()) 14 server.quit() 15 16 发送邮件实例
标签:
原文地址:http://www.cnblogs.com/cp-miao/p/5525291.html