开发者

How do I add "Reply To" to this in Django?

开发者 https://www.devze.com 2023-02-15 21:45 出处:网络
msg = EmailMessage(subject, body, from_email, [to_email]) msg.c开发者_C百科ontent_subtype = \"html\"
msg = EmailMessage(subject, body, from_email, [to_email])
msg.c开发者_C百科ontent_subtype = "html"
msg.send()

How do I add the "reply to" header?


You'll want to add a Reply-To header to the EmailMessage.

headers = {'Reply-To': reply_email}
msg = EmailMessage(subject, body, from_email, [to_email], headers=headers)
msg.content_subtype = "html"
msg.send()


As of Django 1.8 there is an argument that can be passed into the constructor of EmailMessage named reply_to that will handle the headers logic for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消