PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Mail » Mail_Mime » Bug #3742

parseAddressList() returns error with valid formats

Details

Submitted2005-03-08 13:00 UTC
Frommartin at dauphin-mm dot nl
StatusBogus
PackageMail_Mime
PHP Version4.3.10
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2005-03-08 13:00 UTC] martin at dauphin-mm dot nl

Description:
------------
parseAddressList() returns a pear error object when contronted with the following address:

F. Bar <f.bar@example.com>

Note the dots in the name part. "F Bar <f.bar@example.com>" will work as expected.

A solution is to quote the name part as in

"F. Bar" <f.bar@example.com>

Reproduce code:
---------------
$headers = array('From'=> "F. Bar <f.bar@example.com>",
'Subject' => 'Test'
);
require('Mail.php');
require('Mail/mime.php');
$mime = new Mail_mime("\n");
$mime->setTXTBody('Test');
$mime->setHTMLBody('<p>Test</p>');
$body = $mime->get();
$headers = $mime->headers($headers);
$mail =& Mail::factory('mail', "-finfo@example.com");
$t = $mail->send('martin@dauphin-mm.nl', $headers, $body);
if (pear::isError($t)) {
print_r($t);
}

Expected result:
----------------
I expect a test mail to be sent

Actual result:
--------------
$mail->send() returns with a pear error object:

Validation failed for "F. Bar <f.bar@example.com>"

[2005-03-08 13:10 UTC] martin at dauphin-mm dot nl

Hmm ok it seems that this behaviour is according to the RFC...so uhm..never mind