django-allauth HTML电子邮件不发送

Mat*_*ieu 11 django django-allauth

我在我的模板文件夹中添加以下子文件夹和文件以覆盖电子邮件消息(以下文档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
Run Code Online (Sandbox Code Playgroud)

覆盖适用于*.txt版本的电子邮件(意思是,我认为,我有一个正确的文件夹结构)但我的问题是HTML版本不是由django_allauth发送的.

Mat*_*ieu 19

对于那些面临同样问题的人:

当涉及到电子邮件确认时,django_allauth会检查它是否是新用户并相应地查找模板:

所以你必须覆盖:

email_confirmation_message.txt
email_confirmation_signup_message.txt
Run Code Online (Sandbox Code Playgroud)

并添加HTML版本

email_confirmation_message.html
email_confirmation_signup_message.html
Run Code Online (Sandbox Code Playgroud)

  • 另外,我不得不将文件`email_confirmation_signup_message.html`中的文件扩展名更改为`.html`:`{% include "account/email/email_confirmation_message.html" %}` (4认同)