首页 > 编程语言 > 详细

python QQ 发送邮件功能

时间:2021-04-02 12:28:08      阅读:15      评论:0      收藏:0      [点我收藏+]

直接上代码备忘

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 = [chunlin.xu@drcnet.com.cn]  # 接受方邮箱
    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())

 

python QQ 发送邮件功能

原文:https://www.cnblogs.com/xuchunlin/p/14609779.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!