Postfix character encoding?
Posted
by
Anonymous12345
on Server Fault
See other posts from Server Fault
or by Anonymous12345
Published on 2010-12-24T09:56:47Z
Indexed on
2012/07/04
3:18 UTC
Read the original article
Hit count: 551
I use Postfix as a mailserver. I have Ubuntu OS.
Then I use PHP to send emails.
Problem is that none of my emails are encoded properly by a mailsoftware which my VPS provider uses.
According to them, the problem lies with me.
It is only the name field which isn't encoded properly. For example "Björn" becomes "Björn" in my emails.
However, when I echo the $name
, it outputs "Björn" which is correct.
Also, gmail and hotmail does show it correctly.
The strange part is that the "text" (the message itself) is encoded properly.
I use the following for sending mail:
$headers="MIME-Version: 1.0"."\n";
$headers.="Content-type: text/plain; charset=UTF-8"."\n";
$headers.="From: $name <$email>"."\n";
$name= iconv(mb_detect_encoding($name), "UTF-8//IGNORE//TRANSLIT", $name);
//// I HAVE TRIED WITH AND WITHOUT THE LINE ABOVE, NO DIFFERENCE
mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $text, $headers, '[email protected]');
I have tried with and without the iconv line also, no luck.
The last thing I can think of is POSTFIX, could there be a setting for character encoding there? Anybody knows?
© Server Fault or respective owner