ZF-3641: Zend_Mail: Wrong MIME header encoding

Issue Type: Bug Created: 2008-07-14T01:27:26.000+0000 Last Updated: 2008-10-06T08:45:59.000+0000 Status: Resolved Fix version(s): Reporter: Tobias Gies (ruunstalker) Assignee: Nico Edtinger (nico) Tags: - Zend_Mail

Related issues: - ZF-1688



(Posted for Tomas Markauskas on the fw-formats mailing list. The following text is copied from his mail.)

I noticed that subject headers in some emails sent with Zend_Mail aren't shown correctly in Gmail. I think the implementation of RFC 1522 in Zend_Mail::_encodeHeader() is not correct. The RFC 1522 says (, that if the string is too long to fit into 75 characters, it can be written as multiple encoded-words (and not encoded-texts), like this:

Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=

(Thats from RFC 1522 Section 8:

But Zend_Mail uses just the simple Quoted-Printable encoding, which is used in bodies etc. I still don't have any rigths to submit issues in Jira, so I created a page with a simple fix for Zend_Mail/Zend_Mime:

My two classes:

You can see the Zend_Mail result with an example string and the result of my fixed implementation on the page.

As you can also see, the current implementation has problems with strings, containing lots of spaces or question marks, ie. not every line is within required 75 characters. That's fixed there too now.


No comments to display

Have you found an issue?

See the Overview section for more details.


© 2006-2021 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.