def send_email(self, subject, text):
"""!
@brief Send an e-mail to the pre-configured recipients.
"""
if not self.env['enabled']:
return
text = eva.mail.text.MASTER_TEXT % text
message = email.mime.text.MIMEText(text)
message['Subject'] = eva.mail.text.MASTER_SUBJECT % (self.group_id, subject)
try:
mailer = smtplib.SMTP(self.env['smtp_host'])
mailer.send_message(message, from_addr=self.env['from'], to_addrs=self.env['recipients'])
mailer.quit()
except smtplib.SMTPException:
# silently ignore errors
pass
评论列表
文章目录