Tutorial :Accented characters in PHP mail


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

Code is the following:

$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/

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »