标签:smtp ssl html log ring print 服务 bsp import
import smtplib
from email.mime.text import MIMEText
smtpserver = "smtp.qq.com"
port =465
sender = "发件人账号@qq.com"
psw = "smtp服务的授权码"
receiver ="收件人账号@qq.com"
body = ‘<pre><h1> </h1></pre>‘
msg = MIMEText(body,‘html‘,"utf-8")
msg[‘from‘] = sender
msg[‘to‘] = receiver
msg[‘subject‘] = "发送的内容 "
try:
smtp = smtplib.SMTP_SSL(smtpserver, port)
smtp.login(sender, psw)
smtp.sendmail(sender, receiver, msg.as_string())
smtp.quit()
print(‘success‘)
except smtplib.SMTPException:
print(‘ERRO‘)
标签:smtp ssl html log ring print 服务 bsp import
原文地址:https://www.cnblogs.com/wsfsd/p/11038869.html