2
任何人都可以幫助我請如何爲這些字符添加utf-8 Unicode?將Unicode UTF8添加到電子郵件
žýáťčšľľzŽŘ
現在的電子郵件看起來像這樣
Dostali STEnovúsprávu。塗súpodrobnosti:JMA©NO:tár Tel.ÄÃslo:4996611
<?php
$EmailFrom = "...";
$EmailTo = "[email protected]";
$Subject = "Zpráva s ";
$name = Trim(stripslashes($_POST['name']));
$phone = Trim(stripslashes($_POST['phone']));
$email = Trim(stripslashes($_POST['email']));
$message = Trim(stripslashes($_POST['message']));
// validation
$validationOK=true;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $name;
$Body .= "\n";
$Body .= "Tel: ";
$Body .= $phone;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $email;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
感謝
您是否閱讀過有關UTF-8標頭的[手冊](http://php.net/manual/en/function.mail.php)或任何您使用的編碼?你有沒有考慮使用像[phpmailer](http://phpmailer.worxware.com/)這樣的已經制作好的郵件類? –