Django 联系表单发送 html 电子邮件
有没有办法使用 django-contact-form 发送 html 电子邮件?
Is there a way to use the django-contact-form to send a html email?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
有没有办法使用 django-contact-form 发送 html 电子邮件?
Is there a way to use the django-contact-form to send a html email?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
我只是查找了源代码,它不是内置的。
您当然可以随意修改它 - 这是一个非常简单的形式并且非常易读。
您需要添加 html_template 变量/路径并修改保存行,并添加一种方法来指定要使用的模板。
这样可以更轻松地将所有更改保存在一个位置。
否则,您可以重写大部分代码并更改
get_message_dict()
中的方法名称和字符串,以反映EmailMessage
的新字段名称。坦率地说,我是不确定为什么 send_mail 应该具有与
EmailMessage
不同的关键字I just looked up the source and it's not built in.
You can certainly modify it however you please -- it's a very simple form and very readable.
You'd need to add a html_template variable/path and modify the save line, and add a way to specify which template to use.
This is just easier to keep all of your changes in one spot.
Otherwise, you could re-write most of the code and change the method names and the strings in
get_message_dict()
to reflect the new field names forEmailMessage
Frankly, i'm not sure why send_mail should have different keywords than
EmailMessage