16

I add in my templates folder the following subfolders and files in order to override email messages (following docs https://github.com/pennersr/django-allauth#sending-e-mail)a :

templates/
   account/
     email/
       email_confirmation_message.html
       email_confirmation_message.txt
       email_confirmation_subject.txt

The override works perfectly for *.txt version of email (meaning, I think, I have a correct folder structure) but my problem is the HTML version is not send over by django_allauth.

Matthieu
  • 1,084
  • 12
  • 23
  • What version are you using (HTML mails are 0.10+)? Otherwise, I suggest you step through this code: https://github.com/pennersr/django-allauth/blob/052e500965f1e9913c51587f6d9f115ccb3bb21d/allauth/account/adapter.py#L67 to see why things are not being picked up -- your directory structure looks fine. – pennersr Jun 29 '13 at 20:24
  • I am using version 0.11.1. I've read the source but not 'that' thoroughly. I'll read gain. Thanks – Matthieu Jun 30 '13 at 05:51
  • Ok, it turns out that the piece of source code involved is, in fact, the following : https://github.com/pennersr/django-allauth/blob/052e500965f1e9913c51587f6d9f115ccb3bb21d/allauth/account/models.py#L120 If I read carefully the doc it is not mentionned that django_allauth makes a difference between newly registered user or not when it comes to email registration messages. I'll continue my tests, I guess I need 6 templates then (email_confirmation_signup* and email_confirmation*) – Matthieu Jun 30 '13 at 06:17
  • Ok I figured out the whole thing. Clear and easy now. Was really tired yesterday, didn't pay enough attention. What's unclear for me is that my overrided version of email_confirmation_message.txt was send during my test (and not the source version email_confirmation_signup_message.txt) – Matthieu Jun 30 '13 at 06:35

1 Answers1

26

For those facing the same issue :

When it comes to email confirmation django_allauth checks if its a new user or not and looks for template accordingly :

So you'll have to override :

email_confirmation_message.txt
email_confirmation_signup_message.txt

and add HTML version

email_confirmation_message.html
email_confirmation_signup_message.html
Matthieu
  • 1,084
  • 12
  • 23
  • 4
    Also, I had to change the file extension to `.html` inside the file `email_confirmation_signup_message.html`: `{% include "account/email/email_confirmation_message.html" %}` – reinaldoluckman Mar 14 '16 at 16:38
  • What about the {{ user }} and {{ confirmation link }}, How do i add these to the custom template? – Dominic M. Feb 12 '19 at 15:47