|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-08-26 16:51 UTC] janders at javeo dot com
Description:
------------
Email message header with additional quotes in From: field corrupts results returned by imap_headerinfo.
E.g.
Message with this from field:
From: "30"TV" <carpenter@example.com>"
imap_headerinfo produces:
stdClass Object
(
[date] => Wed, 25 Aug 2004 19:16:52 -0800
[Date] => Wed, 25 Aug 2004 19:16:52 -0800
[subject] => Free to new members- Flat Screen TV
[Subject] => Free to new members- Flat Screen TV
[fromaddress] => "30TV <carpenter@example.com>"@t1
[from] => Array([0] => stdClass Object
(
[mailbox] => 30TV <carpenter@example.com>
[host] => t1
)
)
<snip...>
Reading this message from imap server using Outlook produces correct results, with additional quotes simply removed. I also read this message from imap server using Pine, since php uses same c-client. When displaying the message header in Pine, Pine replaced the corrupt "From" field with the non-corrupt "To" field when message header is displayed in the Inbox.
-JA
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 16:00:01 2025 UTC |
I disagree... Php is returning invalid data. Just because the From: field is invalid syntax, that doesn't mean that php should follow suit and provide invalid data. On call to imap_headerinfo, it's returning an invalid mailbox -- i.e., "30TV <carpenter@example.com>"@t1. The code should return an error message or error code, or should return "carpenter", which is the mailbox, and it should properly set "example.com" as the host object. Obviously php is mangling the original field in an attempt to return a valid mailbox string. So, if before returning the string, if php did a simple regexp to test for invalid chars like, if (!ereg("/^([a-zA-Z0-9_\.\-])+/", $str) then it could determin if the mailbox string was valid or not before returning yet another invalid string. Oh well, if not fixed in php I guess I'll have to run my 'if' condition against every mailbox returned by imap_headerinfo. Thanks again for your help, -JA