Issue Type: Bug Created: 2012-06-21T17:07:30.000+0000 Last Updated: 2012-07-13T15:56:00.000+0000 Status: Resolved Fix version(s): Reporter: David Windell (outeredge) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\Mail
Related issues: Attachments: - 1340357064.txt
Invalid headers should ideally be ignored (discuss?), previous version of Zend would not throw an exception when a header such as the first one shown below was set. This header gets set by Postfix.
Array ( [from email@example.com thu jun 21 16] => 42:48 2012 [return-path] => [x-original-to] => firstname.lastname@example.org [delivered-to] => email@example.com [message-id] => 4FE3406C.firstname.lastname@example.org [date] => Thu, 21 Jun 2012 16:40:28 +0100 [from] => Test Person [user-agent] => Mozilla/5.0 ( Windows NT 6.1; WOW64; rv:12.0 ) Gecko/20120428 Thunderbird/12.0.1 [mime-version] => 1.0 [to] => email@example.com [subject] => Test [content-type] => text/plain; charset=ISO-8859-1; format=flowed [content-transfer-encoding] => 7bit )
Posted by David Windell (outeredge) on 2012-06-21T17:08:51.000+0000
Error thrown is;
library/Zend/Mail/Header/GenericHeader.php:102 - Header name must start with a letter, and consist of only letters, numbers and dashes
Posted by David Windell (outeredge) on 2012-06-21T17:13:52.000+0000
After discussion on IRC with DASPRiD, suggestion was to have an option 'Ignore invalid headers'
Posted by Maks 3w (maks3w) on 2012-06-21T21:36:51.000+0000
Invalid headers should throw an exception. Unknown headers should be implemented with GenericHeader
For me [from firstname.lastname@example.org thu jun 21 16] it's not a From invalid header, its a header called "from email@example.com thu jun 21 16"
Posted by David Windell (outeredge) on 2012-06-21T21:56:00.000+0000
Our use case is a email being received from a pipe where custom headers such as the above may be inserted by the MTA. We don't want to have to pre-process the headers before calling addHeaders().
How do you propose this is implemented within GenericHeader, considering how the header "[from firstname.lastname@example.org thu jun 21 16]" is so specific to the environment?
Posted by Maks 3w (maks3w) on 2012-06-22T05:26:03.000+0000
I checked the standard again and the first header can't be a valid field name because has spaces.
I think that, in your case, ignore the first line from the input was enough.
Anyway I opened this PR https://github.com/zendframework/zf2/pull/1549
Posted by David Windell (outeredge) on 2012-07-13T08:49:50.000+0000
Replacement Pull request created https://github.com/zendframework/zf2/pull/1878
Posted by David Windell (outeredge) on 2012-07-13T15:56:00.000+0000
Fixed in latest master (162c087bf203942a53498fc82539d0b26356ebee) from PR1878
Have you found an issue?
See the Overview section for more details.