Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.0

Bug #14807 Failed "From" validation on Windows-1251 encoding
Submitted: 2008-10-16 13:22 UTC
From: madfobos Assigned:
Status: Bogus Package: Mail (version 1.1.14)
PHP Version: 5.2.6 OS: Unix/Windows
Roadmaps: (Not assigned)    
Subscription  


 [2008-10-16 13:22 UTC] madfobos (Artyom Eremeevskiy)
Description: ------------ There is a problem with Russian encoding, when I encode 'From' header field, using mime (which used PHP function: iconv_mime_encode), I get something like this: =?WINDOWS-1251?Q?=C0=F0=F2=E5=EC<mad=5Ffobos@mscript.ru>?= And this failed on validation, while execute send method of Mail class... I checked code, and seems there is a problem, because there is "?=" after e-mail address (but I guess it's right, because it's result of iconv encoding). I seen this bug already, but didn't found any good answer on it. Test script: --------------- $charsets = Array('text_charset' => 'WINDOWS-1251', 'html_charset' => 'WINDOWS-1251', 'head_charset' => 'WINDOWS-1251'); $headers = Array( 'From' => 'Артем<mad_fobos@mscript.ru>', 'To' => 'Артем<mad_fobos@mscript.ru>', 'Subject' => 'test' ); $mime = new Mail_mime(); $hdrs = $mime->headers($headers); $res = Mail_RFC822::parseAddressList($hdrs['From']); print_r($res); Expected result: ---------------- Can't send mail to customer: Validation failed for: =?WINDOWS-1251?Q?=C0=F0=F2=E5=EC<mad=5Ffobos@mscript.ru>?=

Comments

 [2009-08-11 02:07 UTC] schmuwi (Uwe Mesecke)
As far as I understand RFC2047 correctly the bug is in iconv_mime_encode() or whatever method is used to encode the headers. The address is included in the 'encoded-word' and therefore interpreted as text. See examples in section 8: http://tools.ietf.org/html/rfc2047#section-8 The address has to be outside of the encoded-word so programms that are not capable of doing mime can work with the header.
 [2009-09-07 16:35 UTC] yunosh (Jan Schneider)
-Status: Open +Status: Bogus
Thank you for taking the time to write to us, but this is not a bug. Uwe's analysis is correct. Section 5 of RFC 2047 explicitly says: "An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'."