mail.py 文件源码

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

项目:lowfat 作者: softwaresaved 项目源码 文件源码
def staff_reminder(request):  # pylint: disable=invalid-name
    if config.STAFF_EMAIL_REMINDER:
        request_type = type(request).__name__.lower()
        staff_url = "/email/template/{}/staff/reminder/".format(
            request_type
        )

        context = {
            request_type: request,
            "protocol": "https",
            "site": Site.objects.get(id=SITE_ID),
            "FELLOWS_MANAGEMENT_EMAIL": config.FELLOWS_MANAGEMENT_EMAIL,
        }

        flatemail = FlatPage.objects.get(url=staff_url)
        template = Template(flatemail.content)
        jinja_context = Context(context)
        html = template.render(jinja_context)
        plain_text = html2text(html)
        mail_staffs(
            flatemail.title,
            plain_text,
            html_message=html,
            fail_silently=False
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号