def mail(email: str, subject: str, template: Union[str, LazyI18nString],
context: Dict[str, Any]=None, locale: str=None,
headers: dict=None):
headers = headers or {}
with override(locale):
body = str(template)
if context:
body = body.format_map(TolerantDict(context))
sender = Configuration.get_solo().mail_from
subject = str(subject)
body_plain = body
return mail_send_task.apply_async(args=([email], subject, body_plain, sender, headers))
评论列表
文章目录