2011-03-09 20 views
5
msg = EmailMessage(subject, body, from_email, [to_email]) 
msg.content_subtype = "html" 
msg.send() 

如何添加「答覆」標題?如何在Django中添加「Reply To」?

+3

這是在這裏的文檔中討論:http://docs.djangoproject.com/en/dev/topics/email/#emailmessage-objects沒有冒犯,但似乎你的Django的許多問題都包含在文檔中。這些文檔編寫得非常好,並且多次爲您提供一些有關許多主題的精彩而有用的見解。 – 2011-03-14 02:39:14

回答

16

您需要將Reply-To標頭添加到EmailMessage

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

由於Django的1.8的出現是可以傳遞到的EmailMessage命名reply_to構造將要處理的頭邏輯你的理由。

相關問題