如何在Django中添加"回复到"功能?
msg = EmailMessage(subject, body, from_email, [to_email])
msg.content_subtype = "html"
msg.send()
我该怎么添加“回复至”这个标题呢?
2 个回答
16
从Django 1.8开始,EmailMessage
这个类的构造函数里可以传入一个叫做reply_to
的参数,这个参数可以帮你处理邮件头部的相关逻辑。
25
你需要在EmailMessage
中添加一个Reply-To
头信息。
headers = {'Reply-To': reply_email}
msg = EmailMessage(subject, body, from_email, [to_email], headers=headers)
msg.content_subtype = "html"
msg.send()