testing
testing

Reputation: 20279

PHP mail encoding: Is it possible to have special characters in the sender

Is it possible to have special characters like ö, ä, ü, ß, ... in the sender of a mail?

$sender = 'From: Mail with special characters öäüß <[email protected]>';
mail('[email protected]', '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $sender);

Upvotes: 2

Views: 1559

Answers (1)

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

You could do something like this:


$headers = "From: Info \r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/plain; charset=utf-8\r\n";
    $headers .="Content-Transfer-Encoding: 8bit";

    $mes=htmlspecialchars_decode($mes,ENT_QUOTES);//optional
    mail('[email protected]', "=?utf-8?B?".base64_encode($sub)."?=", $mes, $headers);

But yes, using some mailer class is better option: PHPMailer

Upvotes: 2

Related Questions