views.py 文件源码

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

项目:concrete 作者: ande0581 项目源码 文件源码
def send_general_email(customer_id, to_address, subject, body):
    customer_obj = Customer.objects.get(pk=customer_id)
    from_address = config('EMAIL_HOST_USER')
    email = EmailMessage(subject, body, from_address, [to_address])

    # Attempt to send email
    try:
        response = email.send()
    except Exception:
        response = 0

    # Log email in DB
    email_log_entry = {
        'to_address': to_address,
        'subject': subject,
        'body': body,
        'successful': response,
        'customer_id': customer_obj.id
    }

    log_email(**email_log_entry)

    return response
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号