Michiel
Michiel

Reputation: 8103

Use special characters in PHP mail() function

I would like to send some special characters (like é, à, ü,...) by using the PHP mail() function. I tried this: (just a fragment of the code)

    $headers        = 'From: [email protected]';
    $header_        = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";

    $to         = "[email protected]";
    $subject        = 'Confirmation de commande';
    $message        = "Bonjour $firstname";


     if (mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $headers)) {...

But for some reason, all I get is things like sâélève. Advice?

Upvotes: 3

Views: 5610

Answers (1)

Kerrek SB
Kerrek SB

Reputation: 477580

Make sure you set your internal encoding to UTF8 with iconv_set_encoding.

Upvotes: 3

Related Questions