我在Django==1.6.1
上设置了我的django-allauth插件,一切正常,但是当我尝试将确认消息更改为html时,它会发送HTML但只是代码,它不会显示任何样式或颜色或图像,这是我的模板代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Confirma tu correo men</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body style="margin: 0; padding: 0;">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="810" style="border-collapse: collapse;">
<tr>
<td align="center" bgcolor="#2d96da" style="padding: 50px 45px 50px 45px;">
<img src="http://contratalos.s3.amazonaws.com/staticfiles/images/logo_beta.png" alt="Contratalos.com" width="300" height="201" style="display: block;" />
</td>
</tr>
<tr>
<td bgcolor="#000000;" style="color: #ffffff; font-family: Arial, sans-serif; font-size: 14px;">
<br/>
<a href="#" style="color: #ffffff;"><font color="#ffffff"> </font></a>
</td>
</tr>
<tr>
<td style="color: #2d96da; font-family: Arial, sans-serif; font-size: 30px; padding: 90px 65px 90px 65px;">
Bienvenido a Contratalos.com<br/>
<font color="#000000" align="center">Verifica tu correo para que empieces a formar <br /> parte de nuestra comunidad 3.0</font>
<input type="submit" value="Verificar correo" width="300" height="35" style="color:#ffffff; font-size:23px; background-color:#5ac189; margin-top:45px; width: 288px; height: 45px;"><a href="{{ activate_url }}"></a> </input>
</td>
</tr>
<tr>
<td bgcolor="#000000;" style="color: #ffffff; font-family: Arial, sans-serif; font-size: 14px; border:0px;">
Si no deseas seguir recibiendo nuestros correos, puedes editar tus preferencias de <a href="#" style="color: #ffffff;"><font color="#2d96da">notificaciones aqui</font></a>
<br/> Contratalos.com | Inversiones CTRL Venezuela, RIF : J-404528510 C.A., Caracas - Venezuela
</td>
</tr>
</table>
</body>
</html>
此代码放在:
myapp/shared/templates/account/email/index.html
它包含在此.txt文件中:
myapp/shared/templates/account/email/email_confirmation_signup_message.txt
像这样:
{% include "account/email/index.html" %}
我将逻辑几乎完全相同,只是将include
标签更改为它实际发送的index.html
,但在雅虎电子邮件中我只看到模板的代码,但没有颜色,图像等...
任何人都可以对此有所了解吗?
提前致谢!
答案 0 :(得分:3)
没关系
我刚刚将.txt
扩展程序文件更改为.html
因此现在调用包含此html的文件:
myapp/shared/templates/account/email/email_confirmation_signup_message.html
像魅力一样,谢谢你。