如何覆盖django allauth电子邮件模板 [英] How to override django allauth email templates
问题描述
我正在使用 allauth
版本 0.35.0
,并且我想覆盖电子邮件模板以为其创建所需的HTML模板. allauth
登录和SignUp等页面没有问题,但是我找不到用于电子邮件的任何模板.
I'm using allauth
version 0.35.0
and I want to override email templates to make my desired HTML template for them. No problem with allauth
login and SignUp and etc. pages But I can't find any template for emails.
它只是路径/templates/account/email/
中的 .txt
文件.但是,如何为 allauth
任务(如更改其电子邮件的密码等)设置 HTML
消息?
It's just a .txt
file in path /templates/account/email/
. But How can I set HTML
message for allauth
tasks like changing password and etc. for their email messages?
任何帮助将不胜感激.
推荐答案
糟糕!真可惜!
在这部分 allauth
文档这样说:
in this part of allauth
documentation This said that:
发送的电子邮件(例如,如果忘记密码或确认电子邮件)可以通过提供自己的模板进行更改.模板的名称如下:
Emails sent (e.g. in case of password forgotten or email confirmation) can be altered by providing your own templates. Templates are named as follows:
帐户/电子邮件/email_confirmation_subject.txt
帐户/电子邮件/email_confirmation_message.txt
如果要包括HTML表示,请按如下所示添加HTML模板:
In case you want to include an HTML representation, add an HTML template as follows:
帐户/电子邮件/email_confirmation_message.html
因此,在我自己的模板中制作 email_confirmation_message.html
并使用 email_confirmation_message.txt
中使用的模板变量解决了该问题.
So making email_confirmation_message.html
in my own template and using template variables which are used in the email_confirmation_message.txt
solved the problem.
这篇关于如何覆盖django allauth电子邮件模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!