#coding:utf8
from smtplib import SMTP_SSL
from email.header import Header
from email.mime.text import MIMEText

mail_info = {
    "from": "",
    "to": "",
    "host": "smtp.qq.com",
    "username": "",
    "password": "",
    "subject": "test",
    "text": "email test",
    "encoding": "utf-8"
}
smtp = SMTP_SSL(mail_info["host"])
smtp.set_debuglevel(1)
smtp.ehlo(mail_info["host"])
smtp.login(mail_info["username"], mail_info["password"])
msg = MIMEText(mail_info["text"], "plain", mail_info["encoding"])
msg["Subject"] = Header(mail_info["subject"], mail_info["encoding"])
msg["from"] = mail_info["from"]
msg["to"] = mail_info["to"]
smtp.sendmail(mail_info["from"], mail_info["to"], msg.as_string())
smtp.quit()

相关文章:

  • 2021-06-04
  • 2021-12-10
  • 2021-11-30
  • 2022-01-21
  • 2021-12-10
  • 2022-01-22
  • 2021-10-28
  • 2021-08-28
猜你喜欢
  • 2022-02-02
  • 2021-06-18
  • 2021-12-10
  • 2021-12-10
  • 2021-12-19
  • 2021-12-10
  • 2021-12-31
  • 2022-02-21
相关资源
相似解决方案