accented characters in From: cc: bcc: subject: fields
Posted: Sun Mar 14, 2010 3:18 pm
How can I have accented characters appear in email header fields? E.g. below mail will send my name 'René'. When I use it and the email arrives, it says 'RenX' in the From field. I've tried different charsets (iso8859-1 and utf-8), but I either get RenA@ in the message text when in html text mode or Ren? when in plain text mode (viewing my mail through webmail). The From: field says RenX in both cases? I'm using it for a flash form, which outputs utf-8 by default. Though I tried iso8859-1 (gave RenA@ so didn't work), I used utf-8 in this case. So when I can make this one display René both in the From: field and message part, my flash form will work too.
But how to do it? Why won't my email's headers display accented/umlauted characters?
But how to do it? Why won't my email's headers display accented/umlauted characters?
Code: Select all
<?php
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset= UTF-8\r\n";
$headers .= "From: René <email@adres.nl>\r\n";
$OK = mail('info@testmail.nl', 'A question', 'René is my name', $headers);
if ($OK) {
echo 'sent=OK';
}
else {
echo 'sent=failed&reason='. urlencode('There is a problem with the server. Try again later.');
}
?>