views:

25

answers:

2

Hello,

I have a function for sending mail from PHP and I want to be albe to send Czech letters, like ř,ě,š,č,ř,ž,ý,á,é ..

The function goes like this:

function sendMail($to, $from, $subject, $body) {

$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";

$body = iconv("UTF-8", 'ISO-8859-2', $body);

$content = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-2' /></head><body>";

$content .= $body;

$content .=  "</body></html>";


$success = mail($to, $subject, $content, $headers);

if($success)
    return TRUE;
else
    return FALSE;

} // end: function

And the encoding works for all mail clients I have tryed, except google's gmail.

Any idea, how I could improve it, so the gmail also works?

Thanks, Mike.

EDIT: After a while, I realised that it is only 2 characters, that it represents wrong and that is Ř and ž. All other are alright.

A: 

When you say: It doesn't work... what do you mean? What is the expected result and what are you getting?

Codex73
For example '®' insted of 'ř'
Mike
A: 

Leave the formating as UTF-8 , i don't understand why would you convert from utf 8 to language specific encoding :/

Aviatrix
If I leave it as UTF-8, the czech readers and most used mail clients here don't get it.
Mike