如何在Django中添加“回复”?

iovurdzv  于 2022-12-24  发布在  Go
关注(0)|答案(2)|浏览(81)
msg = EmailMessage(subject, body, from_email, [to_email])
msg.content_subtype = "html"
msg.send()

如何添加“回复”标题?

ctehm74n

ctehm74n1#

您需要向EmailMessage添加一个Reply-To头文件。

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

zpgglvta2#

从Django 1.8开始,有一个参数可以传递给EmailMessage的构造函数,名为reply_to,它将为您处理头文件逻辑。

相关问题