我有一个html表单,我不能用UTF-8中的php代码发送。当电子邮件到达时,“ÁŰÚÓÖŐ”字符是:“????”我尝试了很多机会,但我没有成功。谢谢你的帮助
这是我的代码:
<?php
if(!isset($_POST['submit']))
{
echo "error; you need to submit the form!";
}
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
if(empty($name)||empty($email))
{
echo "Name and email are mandatory'";
exit;
}
$email_from = "myemail@myemail.com";
$email_subject = "Megrendeles";
$email_body = "Új üzenet $name rendelőtől.\n".
"email címe: $email\n".
"Leírás:\n $message".
$to = "myemail@myemail.com";
$headers = "From: $email_from \r\n";
$headers .= "Content-Type: text/plain; charset=UTF-8\r\n";
$headers .= "Content-Transfer-Encoding: UTF-8\r\n";
$headers .= "MIME-Version: 1.0";
mail($to,utf8_decode($email_subject),utf8_decode($email_body),utf8_decode($headers));