def _send_mail(self, subject, body):
"""
Send a simple text e-mail. Settings are used to get the recipient.
:param str subject: Subject of the email
:param str body: Body content of the email
"""
try:
msg = MIMEText(body)
msg['Subject'] = subject
msg['From'] = settings.SCORING_EMAIL['reporting']['from']
msg['To'] = settings.SCORING_EMAIL['reporting']['to']
smtp = smtplib.SMTP_SSL(settings.SCORING_EMAIL['host'])
smtp.sendmail(msg['From'], msg['To'], msg.as_string())
smtp.quit()
except Exception as ex:
LOGGER.error('Something went wrong when sending the email: %s', ex)
评论列表
文章目录