How to override django allauth email templates

这一生的挚爱 提交于 2021-02-07 03:01:25

问题


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.

It's just a .txt file in path /templates/account/email/. But How can I set HTMLmessage for allauth tasks like changing password and etc. for their email messages?

Any help will be appreciated.


回答1:


Ooops! Shame on me!

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:

account/email/email_confirmation_subject.txt

account/email/email_confirmation_message.txt

In case you want to include an HTML representation, add an HTML template as follows:

account/email/email_confirmation_message.html

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.



来源:https://stackoverflow.com/questions/51684839/how-to-override-django-allauth-email-templates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!