How to override django allauth email templates
Asked Answered
G

1

19

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.

Guienne answered 4/8, 2018 at 10:51 Comment(0)
G
36

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.

Guienne answered 4/8, 2018 at 12:28 Comment(4)
However, this question still able to help others. Some django newbies need this post.Ac
Helped me indeed. I'm new to Django and wasn't really understanding what the context for overriding was. :)Plate
@Plate I'm happy it helped. Happy Coding, And Happy New Year :)Guienne
Same!! Hope you have a django-related bug-free year. :)Plate

© 2022 - 2024 — McMap. All rights reserved.