【问题标题】:Postfix - Html emails contain random characters后缀 - Html 电子邮件包含随机字符
【发布时间】:2013-04-18 15:27:06
【问题描述】:

我将我的postfix 电子邮件存储到mysql

我注意到一些邮件中出现了一些奇怪的字符,而其他电子邮件则没有。所以,这是随机的。

这是我看到的:

--1001534069-1142425087-1366837456=:47630
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

=0A=0AConfirmation: We received your membership (one-year) p=
ayment  =0A=0A   =0A =0A =0A  =0A =0A =0A =0A=0A Confirmation:: We received =
your membership (one-year) payment=0AHi John Smith,=0AWe re=
............


--1001534069-1142425087-1366837456=:47630
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<html><body><div style=3D"color:#000; background-color:#fff; font-family:ti=
mes new roman, new york, times, serif;font-size:12pt"><div><br></div><div s=
tyle=3D"font-family: 'times new roman', 'new york', times, serif; font-size=
: 12pt;"><div style=3D"font-family: 'times new roman', 'new york', times, s=
erif; font-size: 12pt;"><div class=3D"y_msg_container"><div id=3D"yiv684532=
7653"><div>=0A    <div class=3D"yiv6845327653moz-forward-container">=0A    =
  =0A      <title>Confirmation: We received your membership=
............................

我包含了两种内容类型,奇怪的字符相当引人注目。 我将每封电子邮件保存到一个列类型:text,并带有排序规则:utf8_unicode_ci

对于那些对我使用什么来提取我的后缀电子邮件感兴趣的人,我正在使用 PHP imap_* 函数。

不管怎样,有谁知道为什么那些奇怪的角色会被插话吗? (而其他电子邮件具有完美的 html 或纯文本?)

【问题讨论】:

    标签: php imap postfix-mta


    【解决方案1】:

    这是引用的可打印编码。您需要撤消 content-transfer-encoding,它可能被引用 printable 或 base64。

    【讨论】:

    • 你是对的,经过反复试验,我发现quoted_printable_decode 可以解码它。
    • @coffeemonitor:盲目地应用带引号的可打印解码器是一件愚蠢的事情。您必须解析 Content-Transfer-Encoding 标头。此外,您的代码似乎忽略了 MIME 消息结构;这也是错误的。您不能一次处理“电子邮件”,您必须专注于单个消息部分;它们中的每一个都可以有自己的传输编码。
    猜你喜欢
    • 2015-07-09
    • 2017-12-07
    • 1970-01-01
    • 2011-06-22
    • 2016-10-18
    • 1970-01-01
    • 1970-01-01
    • 2023-03-11
    • 2018-02-01
    相关资源
    最近更新 更多