mail.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:pretalx 作者: pretalx 项目源码 文件源码
def mail(user: User, subject: str, template: Union[str, LazyI18nString],
         context: Dict[str, Any]=None, event: Event=None, locale: str=None,
         headers: dict=None):
    from pretalx.mail.models import QueuedMail
    headers = headers or {}

    with override(locale):
        body = str(template)
        if context:
            body = body.format_map(TolerantDict(context))

        QueuedMail(
            event=event, to=user.email, subject=str(subject), text=body,
            reply_to=headers.get('reply-to'), bcc=headers.get('bcc'),
        ).send()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号