错误不是由PHP发出的,这可能是为什么@不起作用。
见下文!
在php源代码中,您将在ext/imap/php_imap.c中找到函数imap_fetchstructure()
,该函数是mail_fetchstructure_full()
的包装,它是c客户端库的一部分。
在该库中,C客户机/ rfc822.c有一个有趣的一段话:
case 'C': /* possible cc: or Content-<mumble>*/
if (!strcmp (tmp+1,"C")) rfc822_parse_adrlist (&env->cc,d,host);
else if ((tmp[1] == 'O') && (tmp[2] == 'N') && (tmp[3] == 'T') &&
(tmp[4] == 'E') && (tmp[5] == 'N') && (tmp[6] == 'T') &&
(tmp[7] == '-') && body)
switch (MIMEp) {
case -1: /* unknown if MIME or not */
if (!(MIMEp = /* see if MIME-Version header exists */
search ((unsigned char *) s-1,i,
(unsigned char *)"\012MIME-Version",(long) 13))) {
#if 1
/* This is a disgusting kludge, and most of the messages which
* benefit from it are spam.
*/
if (!strcmp (tmp+8,"TRANSFER-ENCODING") ||
(!strcmp (tmp+8,"TYPE") && strchr (d,'/'))) {
MM_LOG ("Warning: MIME header encountered in non-MIME message",
PARSE);
MIMEp = 1; /* declare MIME now */
}
else
#endif
这是你产生错误的唯一场所,根据grep
。这就解释了我认为的大部分谜题。
因此,您有一条消息带有CONTENT-TRANSFER-ENCODING或CONTENT-TYPE行,没有MIME-Version标头。
编辑 MM_LOG被定义为mm_log,这又是一个php/ext/imap/php_imap.c提供的函数。来自imap_fetchstructure()的错误被放入错误列表中(它们不会直接输出!),您可以使用imap_errors()
查询并清空。然后,在关闭资源时,错误不会显示,因为错误列表是空的。
这是一个完美的解决方案!我没有意识到imap_errors(),但它解决了很多问题。谢谢! (评级这个答案将不得不等待,直到我收到足够的声誉...) – BurninLeo 2010-08-03 16:34:45