如何从电子邮件php联系表单发送西里尔文数据?

时间:2014-05-28 16:34:17

标签: php forms email

我有一个php联系表单,我在我的网站上使用,但我想启用表格接受Cyrilic字母,因为现在,如果我使用cyrilic我收到邮件消息这个字符:ТÐμÑÑ,овоÐμ

这是我的剧本:

    <?php

// load the variables form address bar
$subject = $_POST["subject"];
$message = $_POST["message"];
$from = $_POST["from"];
$verif_box = $_POST["verif_box"];

// remove the backslashes that normally appears when entering " or '
$message = stripslashes($message); 
$subject = stripslashes($subject); 
$from = stripslashes($from); 

// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
    // if verification code was correct send the message and show this page
    mail("you@email.com", 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
    // delete the cookie so it cannot sent again by refreshing this page
    setcookie('tntcon','');
} else if(isset($message) and $message!=""){
    // if verification code was incorrect then return to contact page and show error
    header("Location: index.php?subject=$subject&from=$from&message=".urlencode($message)."&wrong_code=true");
    exit;
} else {
    echo "no variables received, this page cannot be accessed directly";
    exit;
    }
?>

1 个答案:

答案 0 :(得分:0)

您的邮件似乎以utf-8的形式提交。 将以下标题添加到您的邮件中:

Content-Type: text/plain; charset=utf-8

用“From”-header中的1个换行符分隔,即"From: $from\nContent-Type: ..."