开发者

Accented characters in PHP mail

I need to send emails with accented characters from a webservice written in nuSoap using PHP mail:

$from="info@mysite.com";
$to="dummy123@gmail.com";
$subject="My strange email";
$body="Hello, i would like to see accented chars like thes: èèéé òòò ç";
$headers  = 'MIME-Version: 1.0' . '\r\n';
$headers .= 'Content-type: text/html; charset=UTF-8' . '\r\n';
// Additional headers
$headers .= 'To: '.$to.'\r\n';
$headers .= 'From: '.$from.'\r\n';
// Mail it
mail($to, $subject, $body, $headers);

Instead of accented chars, i receive bad characters; i've tried to make a web page with header ('Content-type:开发者_运维问答 text/html; charset=utf-8'); and it does not work.

Can anyone help me?

Thanks in advance ! c.


Try this it worked for me! :)

$headers .= "Content-Type: text/html; charset=UTF-8\r\n";


I ususally use the class Rmail which makes mailing with accented characters as well as other mail techniques (like adding attachments) very easy. Maybe you want to give it a try? http://www.phpguru.org/downloads/Rmail/Rmail%20for%20PHP/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜