FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=12216&edit=1

ID: 12216
Updated by: alec@alec.pl
Reported By: kg at pingwincheg dot net
Summary: Incorrect Mail_mime::headers() behaviour (russian
text, utf8)
-Status: Verified
+Status: Closed
Type: Bug
Package: Mail_Mime
Operating System: linux
Package Version: 1.5.2
PHP Version: 5.2.4
Assigned To: cipri
Roadmap Versions:
New Comment:

-Status: Verified
+Status: Closed
This bug has been fixed in SVN.

If this was a documentation problem, the fix will appear on
pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should
be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.




Previous Comments:
------------------------------------------------------------------------

[2009-08-25 08:05:41] cweiske

-Status: Feedback
+Status: Verified


------------------------------------------------------------------------

[2008-11-11 09:10:45] warl0rd

The problem is the extras '=?ISO-8859-1?Q?' (or other enconding code)
and '=?' that appear several times in the subject line after performing:


$headers = $mime->headers($headers);

A quick fix is to overwrite the $headers['subject'] with just one
'=?ISO-8859-1?Q?' at the start and the '=?' in the end.

$headers['subject']='=?ISO-8859-1?Q?'.$subject.'=?';

------------------------------------------------------------------------

[2008-08-15 19:36:30] m0r1arty

$message=new Mail_mime();
$message->_build_params['html_charset']='UTF-8';
$message->_build_params['text_charset']='UTF-8';
$message->_build_params['head_charset']='UTF-8';

$message->_build_params['head_encoding']='base64';
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/

------------------------------------------------------------------------

[2008-06-27 07:06:12] jsandeo

I'm having the same problem.

The following source code is iso-8859-01
###################################
$subject = "This is just a subject line, which goes on for a few
characters, and on and on";
$cabeceras = array_merge(array('From' => $from), $array_to,
array('Subject' => $subject));

$body = $mime->get();
$hdrs = $mime->headers($cabeceras);

print_r($cabeceras);
print_r($hdrs); exit;
###################################
Output:
Array
(
[From] => IberGour [To] => info@ibergour.com
[Cc] => jsandeo@evolucy.com
[Subject] => This is just a subject line, which goes on for a few
characters, and on and on
)
Array
(
[MIME-Version] => 1.0
[From] => IberGour [To] => info@ibergour.com
[Cc] => jsandeo@evolucy.com
[Subject] => This is just a subject line, which goes on for a few
characters, and on and on
[Content-Transfer-Encoding] => 7bit
[Content-Type] => text/plain; charset="ISO-8859-1"
)


Whereas the following won't work:
###################################
$subject = "This is just a subject line España, which goes on for a
few characters, and on and on";
$cabeceras = array_merge(array('From' => $from), $array_to,
array('Subject' => $subject));

$body = $mime->get();
$hdrs = $mime->headers($cabeceras);

print_r($cabeceras);
print_r($hdrs); exit;
#################################
Output:
Array
(
[From] => IberGour [To] => info@ibergour.com
[Cc] => jsandeo@evolucy.com
[Subject] => This is just a subject line España, which goes on for
a few characters, and on and on
)
Array
(
[MIME-Version] => 1.0
[From] => IberGour [To] => info@ibergour.com
[Cc] => jsandeo@evolucy.com
[Subject] =>
=?ISO-8859-1?Q?This=20is=20just=20a=20subject=20line=20Espa=F1a?=

=?ISO-8859-1?Q?,=20which=20goes=20on=20for=20a=20few=20characters,=20an?=
=?ISO-8859-1?Q?d=20on=20and=20on?=
[Content-Transfer-Encoding] => 7bit
[Content-Type] => text/plain; charset="ISO-8859-1"
)


If I send this last message to a gmail account, it displays all messed
up, the subject being truncated at the second =?, and the rest of the
headers being displayed inside the text of the body.

------------------------------------------------------------------------

[2008-06-13 17:24:55] lrajlich

I am also seeing this problem... Sometimes we have non-ascii characters
in our subject line and the ->headers function does not seem to properly
handle this case. It breaks the email headers and the email reader (in
this case, gmail) no longer thinks it is seeing an mime / html email but
spits out the markup as text.

I use the following code:

$headers = array( 'From' => "$fromName <$fromEmail>",
'To' => $email,
'Subject' => $subject
);

Log::writeToLog("testLog","before mime->headers: " .
print_r($headers,TRUE));

//create a mime email message to send
$mime = new Mail_mime("\n");
$mime->setHTMLBody($message);

$message = $mime->get();
$headers = $mime->headers($headers);

Log::writeToLog("testLog","after mime->headers: " .
print_r($headers,TRUE));

and I see the following in my log...

14:17:10 06/13/08 ident [debug] before mime->headers: Array
(
[From] => XXXX
[To] => XXXX
[Subject] => Luke<E2><99><A5><E2><99><A0>~<E2><84><A2><E2><99><AB>
sent you a message!
)

14:17:10 06/13/08 ident [debug] after mime->headers: Array
(
[MIME-Version] => 1.0
[From] => XXXX
[To] => XXXX
[Subject] =>
=?ISO-8859-1?Q?Luke=E2=99=A5=E2=99=A0~=E2=84=A2=E2=99=AB=20=20s?=
=?ISO-8859-1?Q?ent=20you=20a=20message!?=
[Content-Transfer-Encoding] => quoted-printable
[Content-Type] => text/html; charset="ISO-8859-1"
)

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://pear.php.net/bugs/bug.php?id=12216

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 21, '09 at 9:52a
activeDec 21, '09 at 9:52a
posts1
users1
websitepear.php.net

1 user in discussion

Alec: 1 post

People

Translate

site design / logo © 2022 Grokbase