email.py 文件源码

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

项目:tg-utils 作者: thorgate 项目源码 文件源码
def send_email(rcpt_email, email_subject, template_name, template_vars, from_email=None, html=True):
    logger.info("Sending %s to %s", template_name, rcpt_email)

    template_vars.update({
        'SITE_URL': settings.SITE_URL,
    })
    email_content = render_to_string(template_name, template_vars)

    # Send HTML-only email. Mandrill will automatically add the text variant.
    msg = EmailMessage(email_subject, email_content, from_email, [rcpt_email])

    if html:
        msg.content_subtype = "html"

    msg.send()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号