def send_mail(app,
sender='%s service <%s>' % (settings.BRAND, settings.SERVER_EMAIL),
recipients=tuple(),
subject='',
body=''):
if not len(recipients):
return
async with app.smtp as conn:
msg = EmailMessage()
msg['Subject'] = subject
msg['From'] = sender
msg['To'] = ', '.join(recipients)
msg.set_content(body)
return await conn.send_message(msg, sender, recipients, timeout=5)
评论列表
文章目录