我正在使用symfony mailer component并用twig制作HTML模板。
在 symfony profiler 电子邮件部分发送电子邮件后,原始内容是我无法理解的!
那些是什么?它们会影响垃圾邮件级别吗?
这是我的代码:
$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);
还有模板:
1:子级(扩展 2)
{% extends 'emails/content-email.html.twig' %}
{% block emailMessage %}
{{ content | raw}}
{% endblock %}
2:父级
{% 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 %}
最佳答案
这些字符是:
Quoted-Printable 或 QP 编码是一种使用可打印 ASCII 字符的二进制到文本的编码系统。 QP 的工作原理是使用等号 = 作为转义字符。
示例: 以下示例是法语文本(以 UTF-8 编码),其中带有变音符号的字母(例如 é)频率较高。
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)
这对以下引用进行编码:
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)
更多详细信息:https://en.wikipedia.org/wiki/Quoted-printable
感谢留言。
关于php - Symfony 邮件程序原始内容很奇怪,包含 =20 =3D =,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64804952/