python发送邮件

#-*- encoding:utf-8 -*-
import smtplib
handle = smtplib.SMTP('smtp.163.com', 25)
handle.ehlo()
handle.starttls()
handle.ehlo()
handle.login('x@163.com', 'xxx')
msg = "To: x@qq.com\r\nFrom: x@163.com\r\nSubject: test \r\n\r\n test mail\r\n"
handle.sendmail('x@163.com','x@qq.com', msg)
handle.close()

原文地址:https://www.cnblogs.com/itfenqing/p/4429574.html