def send_email(recipients, subject, body):
# TODO Handle errors. Log failed emails, maybe?
try:
yag = yagmail.SMTP(config.GMAIL_USERNAME, config.GMAIL_PASSWORD)
result = yag.send(to=recipients, subject=subject, contents=body)
except SMTPAuthenticationError:
# TODO log this
raise
return result
评论列表
文章目录