Доброго времени суток.
Создаю имейл:
...
subject = loader.render_to_string(f'{path_email_template_folder}/subject.txt', context).replace('\n', ' ')
text_msg = loader.get_template(f'{path_email_template_folder}/body.txt').render(context)
html_msg = loader.get_template(f'{path_email_template_folder}/body.html').render(context)
send_mail(
subject, text_msg, email_from or settings.DEFAULT_FROM_EMAIL, [user.email],
fail_silently=False, html_message=html_msg
)
Шаблон:
From now on, please log in to your account using your email address.
Your account details are as follows:
Password: {{ password }}
Broker key: {{ broker_key }}
Thank you for using our software
Но на почту приходит все в одну строку. Вот что в сорсах GMAIL:
--===============9031269262700428934==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From now on, please log in to your account using your email address.
Your account details are as follows:
Password: KVSx4jByPy
Broker key: 11111
Thank you for using our software,
--===============9031269262700428934==
Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From now on, please log in to your account using your email address.
Your account details are as follows:
Password: KVSx4jByPy
Broker key: 11111
Thank you for using our software,
--===============9031269262700428934==--
В чем проблема может быть? Спасибо.