|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2014-05-05 11:20 UTC] e dot lemanissier at physioflow dot com
Description:
------------
When using the imap_headerinfo on an email with an utf8 encoded from header (for example =?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?), the returned variable does not have any from field. The from information is however available if imap_rfc822_parse_headers(imap_fetchheader()) is used.
Test script:
---------------
var_dump(imap_headerinfo($this->mbox, $mid));
var_dump(imap_fetchheader($this->mbox, $mid));
var_dump(imap_rfc822_parse_headers(imap_fetchheader($this->mbox, $mid)));
Expected result:
----------------
object(stdClass)#22 (17) {
["date"]=>
string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
["Date"]=>
string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
["subject"]=>
string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
["Subject"]=>
string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
["message_id"]=>
string(46) "<0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>"
["toaddress"]=>
string(22) "support@XXX.com"
["to"]=>
array(1) {
[0]=>
object(stdClass)#26 (2) {
["mailbox"]=>
string(7) "support"
["host"]=>
string(14) "XXX.com"
}
}
["fromaddress"]=>
string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
["from"]=>
array(1) {
[0]=>
object(stdClass)#29 (2) {
["mailbox"]=>
string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
["host"]=>
string(7) "UNKNOWN"
}
}
["Recent"]=>
string(1) " "
["Unseen"]=>
string(1) " "
["Flagged"]=>
string(1) " "
["Answered"]=>
string(1) " "
["Deleted"]=>
string(1) " "
["Draft"]=>
string(1) " "
["Msgno"]=>
string(4) " 1"
["MailDate"]=>
string(26) "11-Apr-2014 01:27:57 +0000"
["Size"]=>
string(3) "922"
["udate"]=>
int(1397179677)
}
string(655) "Return-Path: <>
Delivery-Date: Fri, 11 Apr 2014 03:27:57 +0100
Received: from spamreport by localhost id 0MRpI7-1WRWOS48ML-00Skij for
support@XXX.com (mailbox m51559649-71621086);
Fri, 11 Apr 2014 03:27:57 +0100
From: =?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=
Subject: Rapport quotidien du dossier Spam du compte email
support@XXX.com
Date: Fri, 11 Apr 2014 03:27:57 +0100
To: <support@XXX.com>
Message-Id: <0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>
Envelope-To: support@XXX.com
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
"
object(stdClass)#27 (13) {
["date"]=>
string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
["Date"]=>
string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
["subject"]=>
string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
["Subject"]=>
string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
["message_id"]=>
string(46) "<0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>"
["toaddress"]=>
string(22) "support@XXX.com"
["to"]=>
array(1) {
[0]=>
object(stdClass)#28 (2) {
["mailbox"]=>
string(7) "support"
["host"]=>
string(14) "XXX.com"
}
}
["fromaddress"]=>
string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
["from"]=>
array(1) {
[0]=>
object(stdClass)#29 (2) {
["mailbox"]=>
string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
["host"]=>
string(7) "UNKNOWN"
}
}
["reply_toaddress"]=>
string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
["reply_to"]=>
array(1) {
[0]=>
object(stdClass)#30 (2) {
["mailbox"]=>
string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
["host"]=>
string(7) "UNKNOWN"
}
}
["senderaddress"]=>
string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
["sender"]=>
array(1) {
[0]=>
object(stdClass)#31 (2) {
["mailbox"]=>
string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
["host"]=>
string(7) "UNKNOWN"
}
}
}
Actual result:
--------------
object(stdClass)#22 (17) {
["date"]=>
string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
["Date"]=>
string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
["subject"]=>
string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
["Subject"]=>
string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
["message_id"]=>
string(46) "<0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>"
["toaddress"]=>
string(22) "support@XXX.com"
["to"]=>
array(1) {
[0]=>
object(stdClass)#26 (2) {
["mailbox"]=>
string(7) "support"
["host"]=>
string(14) "XXX.com"
}
}
["Recent"]=>
string(1) " "
["Unseen"]=>
string(1) " "
["Flagged"]=>
string(1) " "
["Answered"]=>
string(1) " "
["Deleted"]=>
string(1) " "
["Draft"]=>
string(1) " "
["Msgno"]=>
string(4) " 1"
["MailDate"]=>
string(26) "11-Apr-2014 01:27:57 +0000"
["Size"]=>
string(3) "922"
["udate"]=>
int(1397179677)
}
string(655) "Return-Path: <>
Delivery-Date: Fri, 11 Apr 2014 03:27:57 +0100
Received: from spamreport by localhost id 0MRpI7-1WRWOS48ML-00Skij for
support@XXX.com (mailbox m51559649-71621086);
Fri, 11 Apr 2014 03:27:57 +0100
From: =?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=
Subject: Rapport quotidien du dossier Spam du compte email
support@XXX.com
Date: Fri, 11 Apr 2014 03:27:57 +0100
To: <support@XXX.com>
Message-Id: <0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>
Envelope-To: support@XXX.com
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
"
object(stdClass)#27 (13) {
["date"]=>
string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
["Date"]=>
string(31) "Fri, 11 Apr 2014 03:27:57 +0100"
["subject"]=>
string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
["Subject"]=>
string(72) "Rapport quotidien du dossier Spam du compte email support@XXX.com"
["message_id"]=>
string(46) "<0MRpI7-1WRWOS48ML-00Skij@spamreport.1and1.fr>"
["toaddress"]=>
string(22) "support@XXX.com"
["to"]=>
array(1) {
[0]=>
object(stdClass)#28 (2) {
["mailbox"]=>
string(7) "support"
["host"]=>
string(14) "XXX.com"
}
}
["fromaddress"]=>
string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
["from"]=>
array(1) {
[0]=>
object(stdClass)#29 (2) {
["mailbox"]=>
string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
["host"]=>
string(7) "UNKNOWN"
}
}
["reply_toaddress"]=>
string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
["reply_to"]=>
array(1) {
[0]=>
object(stdClass)#30 (2) {
["mailbox"]=>
string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
["host"]=>
string(7) "UNKNOWN"
}
}
["senderaddress"]=>
string(69) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN"
["sender"]=>
array(1) {
[0]=>
object(stdClass)#31 (2) {
["mailbox"]=>
string(61) "=?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?="
["host"]=>
string(7) "UNKNOWN"
}
}
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
I can basically reproduce this. The problem is the already broken From header: =?utf-8?q?D=C3=A9tection_de_spam_=3Cnoreply=401and1=2Efr=3E?=@UNKNOWN The @UNKNOW has apparently been added by an MTA; the actual domain should have been @1and1.fr. Anyhow, this From header causes the libc-client function mail_fetchenvelope() to misbehave, while mail_fetchheader_full() and a following rfc822_parse_msg() yield the desired results. So this is not a bug in PHP's IMAP extension, but rather a fail of libc-client to properly process erroneously composed or transmitted email addresses.