def sendreport(self, body):
"""
Send a notification by email
:param body: Body of the mail
:return:
"""
smtp = self.config['smtp']
msg = multipart.MIMEMultipart()
msg['From'] = smtp['from']
msg['To'] = smtp['to']
msg['Subject'] = smtp['subject']
msg.attach(text.MIMEText(body, 'plain'))
server = smtplib.SMTP(smtp['host'], smtp['port'])
server.starttls()
server.login(smtp['user'], smtp['password'])
server.sendmail(smtp['from'], smtp['to'], msg.as_string())
server.quit()
评论列表
文章目录