Answer the question
In order to leave comments, you need to log in
Why is the entire text of the email on one line?
Good day.
I create an email:
...
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
--===============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==--
Answer the question
In order to leave comments, you need to log in
By default, the HTML part of the email is displayed; in order to transfer the HTML, you need to add the tag <br>
. If you do not want to format HTML - leave only the text part of the letter.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question