def _send_mime_text_to_email(self, text, email):
"""
:type text: mime_text.MIMEText
:type email: str
:return:
"""
text['To'] = email
try:
pass
connection = smtplib.SMTP(self._smtp_config['host'])
connection.ehlo()
connection.starttls()
connection.ehlo()
connection.login(self._smtp_config['username'], self._smtp_config['password'])
connection.sendmail(self._smtp_config['sender'], email, text.as_string())
connection.quit()
except smtplib.SMTPException:
self._logger.exception('Unable to send email to address "{}"'.format(email))
评论列表
文章目录