Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to override django allauth email templates

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.

like image 344
SirSaleh Avatar asked Aug 04 '18 10:08

SirSaleh


1 Answers

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.

like image 116
SirSaleh Avatar answered Sep 16 '22 18:09

SirSaleh