小编San*_*nip的帖子

Django:电子邮件以 html 形式发送以进行密码重置

发送的重置密码电子邮件将显示为原始 HTML 内容。并非每个用户都会遇到这种情况,但对于相当数量的用户来说,这个问题就会出现。

\n\n

这是我重置密码的网址:

\n\n
from django.contrib.auth.views import password_reset\nurl(r\'^accounts/password/reset/\', password_reset, {\'template_name\':\'users/login.html\',\'html_email_template_name\':\'registration/password_reset_email.html\', \'post_reset_redirect\':\'/users/accounts/login/?reset=1\', \'extra_context\':{\'reset\':\'1\'}}, name=\'password_reset\'),\n
Run Code Online (Sandbox Code Playgroud)\n\n

这些是我的密码重置电子邮件模板:

\n\n

注册/password_reset_email.html

\n\n
{% extends \'users/email_base.html\' %}\n\n{% block content %}\n{% load i18n %}\n\n\n  <table width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#f0f0f0" align="center">\n      <tbody>\n        <tr>\n          <td style="font-size:0;" align="center">\n            <div style="display:inline-block;width:100%;max-width:800px;vertical-align:top;" class="width800 mrt-30">\n              <!-- ID:BG SECTION-1 -->\n              <table class="display-width" style="max-width:800px;" width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff" align="center">\n                <tbody>\n                  <tr>\n                    <td class="padding" align="center">\n                      <div style="display:inline-block;width:100%;max-width:600px;vertical-align:top;font-family:Ubuntu, sans-serif;" class="main-width">\n                        <table class="display-width-inner" style="max-width:600px;" width="100%" cellspacing="0" cellpadding="0" border="0" align="center">\n                          <tbody>\n                            <tr>\n                              <td style="mso-line-height-rule:exactly;line-height:30px;font-size:0;" …
Run Code Online (Sandbox Code Playgroud)

django html-email django-authentication

1
推荐指数
1
解决办法
2641
查看次数

标签 统计

django ×1

django-authentication ×1

html-email ×1