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

Bug #11798 Accent in From field of email causes an error in validation
Submitted: 2007-08-08 13:01 UTC Modified: 2007-10-10 03:46 UTC
From: dlublink Assigned: cipri
Status: Closed Package: Mail_Mime
PHP Version: 5.2.2 OS: Gentoo Linux
Roadmaps: 1.5.3    
Subscription  


 [2007-08-08 13:01 UTC] dlublink (David Lublink)
Description: ------------ It seems to be the accent in the 'from' header that is causing Mail not to work properly. Using MailMime 1.3.1-r2 The error is coming from RFC822 class which is part of the Mail 1.1.14 package. Test script: --------------- $email = new Mail_mime(); $headers = array(); $headers = array('Subject'=>'Test Message é','From'=>'Accentué<accent@banana.com>'); foreach($headers as $key => $value) $headers[$key] = utf8_decode($value); $email->headers($headers); $email->setTxtBody("Hello world\n Lol\n\nDave"); $factory = Mail::factory('mail'); //build mail (but not send it) $body = $email->get(); //build the header lines $headers = $email->headers(); print_r($factory->send('user@domain.net',$headers,$body)); Expected result: ---------------- It should send an email to the specified user with 'Hello world...' in the message body. Actual result: -------------- PEAR_Error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 [code] => [message] => Validation failed for: =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= [userinfo] => [backtrace] => Array ( [0] => Array ( [file] => /usr/share/php/PEAR.php [line] => 572 [function] => PEAR_Error [class] => PEAR_Error [type] => -> [args] => Array ( [0] => Validation failed for: =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= [1] => [2] => 1 [3] => 1024 [4] => ) ) [1] => Array ( [file] => /usr/share/php/Mail/RFC822.php [line] => 198 [function] => raiseError [class] => PEAR [object] => Mail_RFC822 Object ( [address] => [default_domain] => localhost [nestGroups] => [validate] => 1 [addresses] => Array ( [0] => Array ( [address] => =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= [group] => ) ) [structure] => Array ( ) [error] => Validation failed for: =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= [index] => 0 [num_groups] => 0 [mailRFC822] => 1 [limit] => ) [type] => -> [args] => Array ( [0] => Validation failed for: =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= ) ) [2] => Array ( [file] => /usr/share/php/Mail.php [line] => 155 [function] => parseAddressList [class] => Mail_RFC822 [object] => Mail_RFC822 Object ( [address] => [default_domain] => localhost [nestGroups] => [validate] => 1 [addresses] => Array ( [0] => Array ( [address] => =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= [group] => ) ) [structure] => Array ( ) [error] => Validation failed for: =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= [index] => 0 [num_groups] => 0 [mailRFC822] => 1 [limit] => ) [type] => -> [args] => Array ( [0] => =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= [1] => localhost [2] => ) ) [3] => Array ( [file] => /usr/share/php/Mail/mail.php [line] => 114 [function] => prepareHeaders [class] => Mail [object] => Mail_mail Object ( [_params] => [sep] => ) [type] => -> [args] => Array ( [0] => Array ( [MIME-Version] => 1.0 [From] => =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= [Content-Transfer-Encoding] => 7bit [Content-Type] => text/plain; charset="ISO-8859-1" ) ) ) [4] => Array ( [file] => /home/dlublink/test.omni [line] => 29 [function] => send [class] => Mail_mail [object] => Mail_mail Object ( [_params] => [sep] => ) [type] => -> [args] => Array ( [0] => david@hiddendomain.net [1] => Array ( [MIME-Version] => 1.0 [Subject] => =?ISO-8859-1?Q?Test=20Message=20=E9?= [From] => =?ISO-8859-1?Q?Accentu=E9<accent@banana.com>?= [Content-Transfer-Encoding] => 7bit [Content-Type] => text/plain; charset="ISO-8859-1" ) [2] => Hello world Lol Dave ) ) ) [callback] => )

Comments

 [2007-08-08 13:17 UTC] chagenbu (Chuck Hagenbuch)
Thank you for taking the time to write to us, but this is not a bug. Header values have to be ascii - you need to encode them properly first (see RFC 2047).
 [2007-08-08 15:29 UTC] dlublink (David Lublink)
It is encoded as per rfc2047. $headers = $email->headers(); According to the documentation, Mail_mime::_encodeHeaders() encodes the headers using rfc2047. $email->headers(); calls Mail_mime::_encodeHeaders(); They are encoded using PEAR code, how much more properly do I need?
 [2007-08-08 15:42 UTC] dlublink (David Lublink)
I noticed in the encoded string that the encoding includes the entire email address: =?ISO-8859-1?Q?Accentu=E9=20<accent@banana.com>?= perhaps this is why it is not working?
 [2007-08-08 15:43 UTC] chagenbu (Chuck Hagenbuch)
That does look broken, but this is a Mail_Mime bug then.
 [2007-08-11 07:08 UTC] cipri (Cipriano Groenendal)
Thank you for taking the time to report a problem with the package. Unfortunately you are not using a current version of the package -- the problem might already be fixed. Please download a new version from http://pear.php.net/packages.php If you are able to reproduce the bug with one of the latest versions, please change the package version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PEAR. Current release of Mail_Mime is 1.5.2, 1.3.1-r2 doesn't even exists, but sounds to be from 2005.
 [2007-08-12 11:50 UTC] dlublink (David Lublink)
After I had this issue I upgraded MailMime to the version found on your website. According to /usr/share/php/Mail/mime.php * @version CVS: $Id: mime.php,v 1.81 2007/06/21 19:08:28 cipri Exp $
 [2007-08-13 07:53 UTC] dlublink (David Lublink)
I am using MailMime 1.5.2 and it gives me the same error. (According to the source code it is v1.81). So this is still a bug.
 [2007-10-10 03:46 UTC] cipri (Cipriano Groenendal)
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the existing bug instead. Thank you for your interest in PEAR. This is a duplicate of Bug #11238