Php 希伯来语中的接触形式-奇怪的符号

Php 希伯来语中的接触形式-奇怪的符号,php,character-encoding,Php,Character Encoding,我在我的网站上做了一张联系我的表格。 这是php代码: <?php $errors = ''; $myemail = 'yourname@website.com';//<-----Put Your email address here. if(empty($_POST['name']) || empty($_POST['email']) || empty($_POST['message'])) { $errors .= "\n Error: all

我在我的网站上做了一张联系我的表格。 这是php代码:

    <?php 
$errors = '';
$myemail = 'yourname@website.com';//<-----Put Your email address here.
if(empty($_POST['name'])  || 
   empty($_POST['email']) || 
   empty($_POST['message']))
{
    $errors .= "\n Error: all fields are required";
}

$name = $_POST['name']; 
$email_address = $_POST['email']; 
$message = $_POST['message']; 

if (!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", 
$email_address))
{
    $errors .= "\n Error: Invalid email address";
}

if( empty($errors))
{
    $to = $myemail; 
    $email_subject = "Contact form submission: $name";
    $email_body = "You have received a new message. ".
    "name: $name \n\n email: $email_address \n\n\n $message";

    $headers = "From: $myemail\n"; 
    $headers .= "Reply-To: $email_address";

    mail($to,$email_subject,$email_body,$headers);
    //redirect to the 'thank you' page
    header('Location: contact_thanks.html');
} 
?>

当我使用网站上的表格时,我收到一封带有奇怪符号的邮件。这是因为我用希伯来语写的形式——英文信传递得很好。 当我将“myemail”改为另一封邮件时,即使是希伯来文,邮件也能很好地传递,但我希望邮件传递到第一封邮件

我更改了很多次编码,但似乎都没有解决问题,也许我还没有尝试正确的编码


我不是编写代码的人,我不太懂php,所以请给我简单易懂的答案。

您必须在邮件标题中指定内容编码。因此,请添加以下行:

$headers .= "\nContent-type: text/html; charset=UTF-8";

您必须在邮件头中指定内容编码。因此,请添加以下行:

$headers .= "\nContent-type: text/html; charset=UTF-8";