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))
评论列表
文章目录