note 98809 added to function.imap-headerinfo
| From: | andyltm at osu1 dot php dot net | Date: | Thu, 08 Jul 2010 22:17:02 +0000 |
| Subject: | note 98809 added to function.imap-headerinfo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170804@lists.php.net to get a copy of this message | ||
When I was testing imap_headerinfo() with an e-mail that had multiple recipients (multiple e-mails
in to to: and/or cc: field), I noticed that imap_headerinfo() was failing hard for me on PHP
5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7 (cli).
Rather than providing me an array with each and every e-mail address listed in the to and/or cc
fields, it was only providing me the first listed. This was disappointing.
[to] => Array
(
[0] => stdClass Object
(
[mailbox] => game
[host] => blunts.com
)
)
Luckily, there was a cool workaround to this problem:
imap_rfc822_parse_headers(imap_fetchheader( string ); which subsequentally worked like a nice little
pet would:
[to] => Array
(
[0] => stdClass Object
(
[mailbox] => game
[host] => blunts.com
)
[1] => stdClass Object
(
[mailbox] => dutch
[host] => masters.com
)
)
TL;DR:
So in other words, instead of imap_headerinfo() use imap_rfc822_parse_headers(imap_fetchheader()).
Hope this helps anyone else that runs into this issue from now into the future. This post was
suggested by people in #PHP on FreeNode IRC.
----
Server IP: 69.147.83.197
Probable Submitter: 72.209.19.220
----
Manual Page -- http://www.php.net/manual/en/function.imap-headerinfo.php
Edit -- https://master.php.net/note/edit/98809
Del: integrated -- https://master.php.net/note/delete/98809/integrated
Del: useless -- https://master.php.net/note/delete/98809/useless
Del: bad code -- https://master.php.net/note/delete/98809/bad+code
Del: spam -- https://master.php.net/note/delete/98809/spam
Del: non-english -- https://master.php.net/note/delete/98809/non-english
Del: in docs -- https://master.php.net/note/delete/98809/in+docs
Del: other reasons-- https://master.php.net/note/delete/98809
Reject -- https://master.php.net/note/reject/98809
Search -- https://master.php.net/manage/user-notes.php