Closed
Description
Describe the bug
Message::getFrom()
returns a string
instead of an object for mails with such a header:
From: "Facebook" <notification@facebookmail.com>
To: "…" <…>
Subject: …
Date: Fri, 1 Oct 2020 01:01:01 +0200
Message-ID: <…@facebookmail.com>
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_NextPart_…"
X-Priority: 3
X-Mailer: ZuckMail [version 1.00]
Thread-Index: …==
X-Facebook: from 2401:db00:321c:e0b:face:0:170:0 ([MTI3LjAuMC4x])
by www.facebook.com with HTTPS (ZuckMail);
X-Facebook-Notify: msg; from=123456789012345; t=cid.c.…:…; mailid=…
X-FACEBOOK-PRIORITY: 0
X-Auto-Response-Suppress: All
To Reproduce
Steps to reproduce the behavior:
- Fetch a mail like the above one
// […] $folders = $c->getFolders(); foreach ($folders as $folder) { $msgs = $folder->messages(); $msgs = $msgs->setFetchBody(false); $mails = $msgs->all()->get(); foreach ($mails as $mail) { var_dump($mail->getFrom());
- you'll get
string(15) "123456789012345"
Expected behavior
[0]=>
object(stdClass)#1234 (5) {
["personal"]=>
string(35) "Facebook"
["mailbox"]=>
string(5) "notification"
["host"]=>
string(8) "facebookmail.com"
["mail"]=>
string(14) "notification@facebookmail.com"
["full"]=>
string(52) "Facebook <notification@facebookmail.com>"
}
}
Desktop:
- OS: GNU/Linux
- PHP: 7.4.3