python HTML格式发送邮件
登录qq邮箱:设置->账户 找到如图片处开启smtp 通过第三方发送邮件都需开启POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务,本人用的qq邮箱进行发送详情请点击http://service.mail.qq.com/cgi-bin/help?subtype=1&no=167&id=28 以下是代码: import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.header import Header msg_from = '1223739055@qq.com' # 发送方邮箱 passwd = 'mizfilyvxaxajgfe' # 填入发送方邮箱的授权码 msg_to = '18010421017@sina.cn' # 收件人邮箱 # 创建一个带附件的实例 message = MIMEMultipart() message['From'] = Header("冰石头", 'utf-8') message['To'] = Header("收件人名称", 'utf-8') subject = 'Python SMTP 邮件测试' # 主体内容 #subject = unicode