錯誤不是由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