четверг, 5 ноября 2009 г.

UTF8 php mail function

If $to, $subject, $message in UTF8.

$to= "=?utf-8?B?".base64_encode($to)."?=";

$subject = "=?utf-8?B?".base64_encode($subject)."?=";

$headers =
“Content-Type: text/plain; ”
. “charset=UTF-8; format=flowed\n”
. “MIME-Version: 1.0\n”
. “Content-Transfer-Encoding: 8bit\n”
. “X-Mailer: PHP\n”;

mail($to, $subject, $message, $headers);

see also: http://geoland.org/2007/12/utf8-ready-php-mail-function/

Комментариев нет: