Python SMTP 发送纯文本

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

from email.mime.text import MIMEText
import smtplib
import getpass
 
msg = MIMEText('这是一封来自python的纯文本邮件','plain','utf-8')
 
from_addr = '发件人邮箱地址'
password = getpass.getpass('Password:')
smtp_server = 'smtp.163.com'
smtp_port = 994
to_addr = '收件人邮箱地址*'
 
 
server = smtplib.SMTP(smtp_server,smtp_port)
server.starttls()
server.set_debuglevel(1)
server.login(from_addr,password)
server.sendmail(from_addr,[to_addr],msg.as_string())
server.quit()