@mx6001

Почему в Django при отправке email происходит непонятная кодировка?

Отправляю HTML:
msg = EmailMessage(subject, HTML, from_user, [email])
msg.content_subtype = "html"
msg.send()


Почему то во все сообщения в местах где есть кавычки или знак равно добавляет 3D:
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DU=
TF-8">

<td style=3D"vertical-align: top;    backgr=
ound: #2D3349; text-align: center;border-radius: 3px 3px 0 0;padding: 40px =
0px;">


Сам текст в сообщении при этом выглядит вот так:
=D0=A4=D0=BE=D0=
=BD=D0=B4 =D0=90=D0=BB=D1=8C=D1=82=D0=B5=D1=80=D0=BD=D0=B0=D1=82=D0=B8=D0=
=B2=D0=BD=D1=8B=D1=85 =D0=98=D0=BD=D0=B2=D0=B5=D1=81=D1=82=D0=B8=D1=86=D0=
=B8=D0=B9


Заголовки письма

Content-Type: text/html; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Subject: =?utf-8?b?0JfQsNC/0YDQvtGBINC90LAg0LLQtdGA0LjRhNC40LrQsNGG0LjRjg==?=
From: foo@yandex.ru
To: empl@employee.ru
Date: Sun, 21 May 2017 18:40:26 -0000
Message-ID: <20170521184026.13720.22414@my-comp>
  • Вопрос задан
  • 336 просмотров
Решения вопроса 1
sim3x
@sim3x
https://www.google.com.ua/search?q=http-equiv%3D3D

The HTML is encoded with what is called quoted-printable. Basically an = at the end of a line indicates a line wrap, so

he=
llo

should be read as "hello" and not as "he llo"

because the = has this special meaning some other character (sequence) is needed to put = characters in the text literally, and that is =3D
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы