直接上代码备忘

import smtplib
from email.mime.text import MIMEText
from email.header import Header
from email.mime.multipart import MIMEMultipart

def send_email():

    msg_from = '11111111@qq.com'  # 发送方邮箱
    passwd = ' 1111111111111'  # 就是上面的授权码
    to = ['xxxxxxxxxxxxxx']  # 接受方邮箱
    msg = MIMEMultipart()
    conntent = "10.0.0.21 爬虫服务异常,请检查"
    msg.attach(MIMEText(conntent, 'plain', 'utf-8'))
    msg['Subject'] = "20.0.0.11爬虫异常"
    msg['From'] = msg_from
    s = smtplib.SMTP_SSL("smtp.qq.com", 465)
    s.login(msg_from, passwd)
    s.sendmail(msg_from, to, msg.as_string())

 

相关文章:

  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2021-07-10
  • 2021-07-09
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-11
  • 2021-05-29
  • 2021-05-12
  • 2021-08-25
相关资源
相似解决方案