I am trying to define my own email template, which is sent when the user asks for a password, but it does not work when adding part of the HTML.
This is the template:
{% trans_default_domain 'FOSUserBundle' %} {% block subject %} {% autoescape false %} {{ 'resetting.email.subject'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} {% endautoescape %} {% endblock %} {% block body_text %} {% autoescape false %} {{ 'resetting.email.message'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} {% endautoescape %} {% endblock %} {% block body_html %} {% autoescape false %} <div dir="ltr" style="display: block; width: 100%; background: #ffffff"> <table style='width: 100%; border: none'> <tr style='height: 20px; background-color: #5A82FF'> <td></td> </tr> <tr> <td style="padding: 30px 0; font-family: Verdana"> {{ 'resetting.email.message_html'|trans({'%username%': user.username, '%confirmationUrl%': confirmationUrl}) }} </td> </tr> <tr style='height: 20px; background-color: #4ED53E'> <td></td> </tr> </table> </div> {% endautoescape %} {% endblock %}
When a password request is sent, mail is received in text format with parts embedded in it, thus:
Estimado jstuardo@desytec.com ! Para restablecer tu contraseña - por favor visita http://xxx.xxx.xxx.xxx Atte, El equipo de XXX <div dir="ltr" style="display: block; width: 100%; background: #ffffff"> <table style='width: 100%; border: none'> <tr style='height: 20px; background-color: #5A82FF'> <td></td> </tr> <tr> <td style="padding: 30px 0; font-family: Verdana"> Estimado jstuardo@desytec.com ! <br /><br /> Para restablecer tu contraseña - por favor visita http://xxx.xxx.xxx.xxx <br /><br /> Atte,<br /> El equipo de XXX </td> </tr> <tr style='height: 20px; background-color: #4ED53E'> <td></td> </tr> </table> </div>
What could be wrong?
Thanks Jaime
source share