Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 后缀-Html电子邮件包含随机字符_Php_Imap_Postfix Mta - Fatal编程技术网

Php 后缀-Html电子邮件包含随机字符

Php 后缀-Html电子邮件包含随机字符,php,imap,postfix-mta,Php,Imap,Postfix Mta,我正在将我的postfix电子邮件存储到mysql中 我注意到一些邮件中出现了一些奇怪的字符,而其他邮件中没有这些字符。所以,这是随机的 我看到的是: --1001534069-1142425087-1366837456=:47630 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =0A=0AConfirmation: We received your membership

我正在将我的
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=
............................
--1001534069-1142425087-1366837456=:47630
内容类型:文本/纯文本;字符集=utf-8
内容传输编码:引用可打印
=0A=0A确认:我们收到了您的会员资格(一年期)p=
付款=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A确认::我们收到=
您的会员资格(一年)付款=0AHi John Smith,=0AWe re=
............
--1001534069-1142425087-1366837456=:47630
内容类型:text/html;字符集=utf-8
内容传输编码:引用可打印

=0A=0A= =0A确认:我们已收到您的会员资格= ............................
我包括了这两种内容类型,奇怪的角色是相当明显的。 我正在将每封电子邮件保存到一个列类型:
text
,带有排序规则:
utf8\u unicode\u ci

对于那些对我用来提取后缀电子邮件感兴趣的人,我使用PHP
imap.*
函数


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

这是引用的可打印编码。您需要撤消内容传输编码,该编码可能是quoted printable或base64。

您说得对,经过反复试验,我发现
quoted printable\u decode
对其进行了解码。@coffeemonitor:盲目应用quoted printable解码器是件愚蠢的事情。您必须解析
内容传输编码
标题。此外,您的代码似乎忽略了MIME消息结构;这也是错误的。你不能一次处理“电子邮件”,你必须专注于单独的信息部分;它们中的每一个都可以有自己的传输编码。