Cris
Cris

Reputation: 12194

Accented characters in PHP mail

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

$from="[email protected]";
$to="[email protected]";
$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.

Upvotes: 1

Views: 2638

Answers (2)

crystallove18
crystallove18

Reputation: 101

Try this it worked for me! :)

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

Upvotes: 3

sprain
sprain

Reputation: 7672

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/

Upvotes: 1

Related Questions