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

ID: 12216
Comment by: power_wong
Reported By: power at base23 dot com
Summary: Incorrect Mail_mime::headers() behaviour (russian
text, utf8)
Status: Closed
Type: Bug
Package: Mail_Mime
Operating System: linux
Package Version: 1.5.2
PHP Version: 5.2.4
Assigned To: cipri
New Comment:

The key setting should be the 'head_charset'. I quoted my working code
at below:

$mime = new Mail_mime;
$mime->setTXTBody($text);
$mime->setHTMLBody($html_message);
$mimeparams=array();
$mimeparams['text_encoding']="7bit";
$mimeparams['text_charset']="UTF-8";
$mimeparams['html_charset']="UTF-8";
$mimeparams['head_charset']="UTF-8";

$body = $mime->get($mimeparams);
$headers = $mime->headers($headers);
$page_content = "Mail now.";

$mail =& Mail::factory('mail');


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

[2010-03-03 07:31:22] roger

this bug is still remaining. I try to send letters with Russian text in
subject. Some of characters are not printable and displayed as ??. I
used this part of code:
$message->_build_params['head_encoding']='base64';

and amount of non-printable characters was decreased, but still
ramaining. Without this code subject was:
Subject:
=?utf-8?Q?0KHQutGA0LjQv9GCINC+0YLQv9GA0LDQstC60Lgg0L/QuNGB0LXQ?=
=?utf-8?B?vCAoMC4xLjMuMSk=?=

with "head_encoding = base64" subject is

Subject:
=?utf-8?B?0KHQutGA0LjQv9GCINC+0YLQv9GA0LDQstC60Lgg0L/QuNGB0LXQ?=
=?utf-8?B?vCAoMC4xLjMuMSk=?=

is it bug?
This is my mail script (body and subject contain Russian text. Body
displaying perfect!)

$text = '????????? ?????? ??????';
$html = '<html><body><h1>HTML ?????? ??????</h1><img
src="header-logo2.jpg" alt="Header Logo" /><p>?????? ?????????? ?
??????? ?????????? PEAR</p></body></html>';

$file = $abs_path.'/images/header-logo2.jpg';
$crlf = "\r\n";
$hdrs = array(
'From' => 'webmaster@vubor.org.ua',
'Subject' => '?????? ???????? ????? (0.1.3.1)'
);

$mime = new Mail_mime($crlf);
$get_param = array(
"text_encoding" => "base64",
"html_encoding" => "base64",
"head_charset" => "utf-8",
"text_charset" => "utf-8",
"html_charset" => "utf-8"
);
$mime->_build_params['head_encoding']='base64';

$mime->setTXTBody($text);
$mime->addHTMLImage($file, 'image/jpeg');
$mime->setHTMLBody($html);
$body = $mime->get($get_param);
$hdrs = $mime->headers($hdrs);

$mail =& Mail::factory('mail');
$status = $mail->send('blomnik@gmail.com', $hdrs, $body);
if (PEAR::isError($status))
{
print("ERROR: Mail not sent!");
}

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

[2009-12-21 09:52:04] alec

<div id="changeset">
<span class="removed">-Status: Verified</span>
<span class="added">+Status: Closed</span>
</div>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.

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

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

<div id="changeset">
<span class="removed">-Status: Feedback</span>
<span class="added">+Status: Verified</span>
</div>

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

[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';
/*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/

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

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
postedOct 25, '11 at 7:19a
activeOct 25, '11 at 7:19a
posts1
users1
websitepear.php.net

1 user in discussion

Power_wong: 1 post

People

Translate

site design / logo © 2022 Grokbase