emailer.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:webbreaker 作者: target 项目源码 文件源码
def cloudscan_notify(self, recipient, subject, git_url, ssc_url, state, scan_id, scan_name):
        try:
            msg = MIMEMultipart()
            msg['From'] = self.from_address
            msg['To'] = recipient
            msg['Subject'] = subject

            html = str(self.email_template).format(git_url, ssc_url, scan_name, scan_id, state, self.chatroom)
            msg.attach(MIMEText(html, 'html'))

            mail_server = smtplib.SMTP(self.smtp_host, self.smtp_port)
            mail_server.sendmail(msg['From'], msg['To'], msg.as_string())

            mail_server.quit()
        except (Exception, AttributeError) as e:  # we don't want email failure to stop us, just log that it happened
            Logger.app.error("Your emailer settings in config.ini is incorrectly configured. Error: {}".format(e))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号