php - Symfony mailer raw content is weird, contains =20 =3D =
I'm using symfony mailer component and making the HTML template with twig.
After sending email in symfony profiler email section, the raw content is something I can't understand!
What are those? do they affect the spamminess level?
And this is my code:
$email = (new TemplatedEmail())
->from(new Address($this->container->getParameter('mailer_no_replay'), 'B2B Marketing'))//TODO: Translation
->to(new Address($lead->getEmail(), $lead->getName()))
->subject($emailTemplate->getSubject())
->htmlTemplate('emails/email-messages/crm-email.html.twig')
->context([
'user' => $lead,
'content' => $mailContent,
]);
$this->mailer->send($email);
And the templates:
1: child (extends 2)
{% extends 'emails/content-email.html.twig' %}
{% block emailMessage %}
{{ content | raw}}
{% endblock %}
2: parent
{% extends 'emails/emailBase.html.twig' %}
{#
This Template used for rendering emails that just have a content not need to render anything else
#}
{% block content %}
<div style="background-color:#ffffff;">
<div class="block-grid"
style="Margin: 0 auto; min-width: 320px; max-width: 790px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: #e8f5f8;">
<div style="border-collapse: collapse;display: table;width: 100%;background-color:#e8f5f8;">
<!--[if (mso)|(IE)]>
<table width="100%" cellpadding="0" cellspacing="0" border="0"
style="background-color:#ffffff;">
<tr>
<td align="center">
<table cellpadding="0" cellspacing="0" border="0" style="width:790px">
<tr class="layout-full-width" style="background-color:#e8f5f8"><![endif]-->
<!--[if (mso)|(IE)]>
<td align="center" width="790"
style="background-color:#e8f5f8;width:790px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;"
valign="top">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding-right: 25px; padding-left: 25px; padding-top:60px; padding-bottom:60px;">
<![endif]-->
<div class="col num12"
style="min-width: 320px; max-width: 790px; display: table-cell; vertical-align: top; width: 790px;">
<div style="width:100% !important;">
<!--[if (!mso)&(!IE)]><!-->
<div
style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:60px; padding-bottom:60px; padding-right: 25px; padding-left: 25px;">
<!--<![endif]-->
<!--[if mso]>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding-right: 20px; padding-left: 20px; padding-top: 10px; padding-bottom: 5px; font-family: Arial, sans-serif">
<![endif]-->
<div
style="color:#34495e;font-family:Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif;line-height:1.5;padding-right:20px;padding-bottom:5px;padding-left:20px;">
<div
style="line-height: 1.5; font-size: 13px; color: #34495e; font-family: Open Sans, Helvetica Neue, Helvetica, Arial, sans-serif; mso-line-height-alt: 18px;">
{% block emailMessage %}{% endblock %}
</div>
</div>
</div>
<!--<![endif]-->
</div>
</div>
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
</div>
</div>
</div>
{% endblock %}
Answer
Solution:
These characters are:
Quoted-Printable, or QP encoding, is a binary-to-text encoding system using printable ASCII characters. QP works by using the equals sign = as an escape character.
Example: The following example is a French text (encoded in UTF-8), with a high frequency of letters with diacritical marks (such as the ?�).
J'interdis aux marchands de vanter trop leurs marchandises. Car ils se font=
vite p=C3=A9dagogues et t'enseignent comme but ce qui n'est par essence qu=
'un moyen, et te trompant ainsi sur la route =C3=A0 suivre les voil=C3=
=A0 bient=C3=B4t qui te d=C3=A9gradent, car si leur musique est vulgaire il=
s te fabriquent pour te la vendre une =C3=A2me vulgaire.
=E2=80=94=E2=80=89Antoine de Saint-Exup=C3=A9ry, Citadelle (1948)
This encodes the following quotation:
J'interdis aux marchands de vanter trop leurs marchandises. Car ils se font vite p?�dagogues et t'enseignent comme but ce qui n'est par essence qu'un moyen, et te trompant ainsi sur la route ?� suivre les voil?� bient??t qui te d?�gradent, car si leur musique est vulgaire ils te fabriquent pour te la vendre une ??me vulgaire.
??�??�Antoine de Saint-Exup?�ry, Citadelle (1948)
More details: https://en.wikipedia.org/wiki/Quoted-printable
Thanks to msg.
Source