Hello!
I'm using a form to send a mail using PHP's mail() function. I'm having some trouble getting the character encoding just right. I need it to be in UTF-8 since i want Swedish characters allowed.
Setup is the following: the form is in UTF-8. The information is sent using an Ajax call to a php file that is encoded in UTF-8. Then, I send the mail with:
Now, sending this to a gmail address works fine, no problems at all with the encoding. My work mail approves of it too (it puts it in quarantine but that's a later question :)), but Hotmail doesn't like it, it destroys the special characters in the "mail list" view.
Where am I going wrong? :)
I'm using a form to send a mail using PHP's mail() function. I'm having some trouble getting the character encoding just right. I need it to be in UTF-8 since i want Swedish characters allowed.
Setup is the following: the form is in UTF-8. The information is sent using an Ajax call to a php file that is encoded in UTF-8. Then, I send the mail with:
Code:
$header = "";
$header .= "Reply-To: xxx <postmaster@".$_SERVER['SERVER_NAME'].">\r\n";
$header .= "Return-Path: xxx <postmaster@".$_SERVER['SERVER_NAME'].">\r\n";
$header .= "From: xxx <postmaster@".$_SERVER['SERVER_NAME'].">\r\n";
$header .= "Organization: xxx \r\n";
$header .= "Content-Type: text/plain; charset=utf-8\r\n";
$sent = mail("xxx", "Subject with Swedish chars", $message, $header);
Where am I going wrong? :)
Comment