用Python的smtp模块发邮件的示例

# -*- coding: UTF-8 -*-
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText msg = MIMEMultipart()
msg["From"] = "fuhanw@qq.com"
msg["To"] = "fuhanw@foxmail.com"
msg["Subject"] = "这是一封来自Python的邮件" text = MIMEText("这是一封来自Python的邮件 这是一封来自Python的邮件 这是一封来自Python的邮件")
msg.attach(text) smtp = smtplib.SMTP()
smtp.connect("smtp.qq.com", "")
smtp.login("fuhanw@qq.com", "xxxxxxxx")
smtp.sendmail("fuhanw@qq.com", "fuhanw@foxmail.com", msg.as_string())
smtp.quit()
上一篇:Mysql中实现row_number


下一篇:BZOJ_4378_[POI2015]Logistyka_树状数组