PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail » Bug #2242

Error with UTF-8 Headers

Details

Submitted2004-08-28 01:01 UTC
Fromthomas at haeber dot de
StatusNo Feedback
PackageMail
PHP Version5.0.1
OSSuSE Linux 9.1 (Kernel 2.6.5)
Roadmaps(Not assigned)

Comments

[2004-08-28 01:01 UTC] thomas at haeber dot de

Description:
------------
used Mail 1.1.3 stable

UTF-8 headers like:

Array
(
[MIME-Version] => 1.0
[From] => Bau =?UTF-8?Q?Dr=C3=B6mling?= e.G -
Hauptsitz <name@example.de>
[To] => name@example.de
[Subject] => =?UTF-8?Q?Best=C3=A4tigung?= Ihrer
Anfrage bei der Bau =?UTF-8?Q?Dr=C3=B6mling?= e.G.
[Content-Type] => text/plain; charset="UTF-8"
[Content-Transfer-Encoding] => 8bit
)

will abort with the following Error-Message:
Fatal error: Cannot use object of type PEAR_Error as array
in /usr/local/lib/php/Mail.php on line 136

Reproduce code:
---------------
$headers = array(
"MIME-Version" => "1.0",
"From" => "Bau =?UTF-8?Q?Dr=C3=B6mling?= e.G - Hauptsitz <name@example.de>",
"To" => "name@example.de",
"Subject" => "=?UTF-8?Q?Best=C3=A4tigung?= Ihrer Anfrage bei der Bau =?UTF-8?Q?Dr=C3=B6mling?= e.G.",
"Content-Type" => "text/plain; charset=\"UTF-8\"",
"Content-Transfer-Encoding" => "8bit"
);

$mail->send("name@example.de", $headers, "some text");

Expected result:
----------------

Actual result:
--------------
Fatal error: Cannot use object of type PEAR_Error as array
in /usr/local/lib/php/Mail.php on line 136

[2004-08-28 01:05 UTC] thomas at haeber dot de

Of course i created a valid mail-object, firsty; e.g.:

$mail_params["sendmail_path"] = "path/to/sendmail/";
$mail =& Mail::factory("sendmail", $mail_params);

[2004-09-10 00:02 UTC] thomas at haeber dot de

After hours, I've found a solution for my Problem. If you
use quotemarks for the personal-part of an e-mail the RFC
822-Test will pass.

e.g use:
"Bau =?UTF-8?Q?Dr=C3=B6mling?= e.G" - Hauptsitz
<name@example.de>
instead of:
Bau =?UTF-8?Q?Dr=C3=B6mling?= e.G - Hauptsitz
<name@example.de>

By The Way the RFC 822-Test shouldn't fail if you don't
use quotemarks. And the Mail-package should send such an
Mail.

And good work with the resolved fatal error-bug.

[2005-02-25 11:46 UTC] bugs-horde at interfasys dot ch

I have the same problem with Horde 3.0.3 and IMP 4.0.2.

If I have some non-ascii characters in the name of the identity (ie. sàrl which is pretty common since it's gmbh), then the message cannot be sent using UTF-8 encoding.

I either have to switch to ISO8859-15 or change the name of the sender.

[2006-11-20 12:51 UTC] karsten at typo3 dot org

I just stumbled over the same bug - recipient addresses containing special (non-ascii) characters in encoded form are only accepted if all double quotes are stripped from the address...
PEAR Mail 1.1.14
PHP 4.3.10