繁体   English   中英

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

[英]How to send Cyrillic data from e-mail php contact form?

我在我的网站上使用了一个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;
    }
?>

看来您的邮件是以utf-8格式提交的。 将以下标头添加到您的邮件中:

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

用1个换行符将其与“发件人” "From: $from\\nContent-Type: ..." ,即"From: $from\\nContent-Type: ..."

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM