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:
Expand|Select|Wrap|Line Numbers
- $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? :)