问题在于制作一个漂亮的html联系表单设计以及通过html表而不是纯文本邮件接受用户发送邮件的问题
这是我使用的代码这是我在php上的第一部作品 如果我使用基于网络的邮件帐户(gmail)
,它工作正常但如果我将配方移动到另一个帐户(到我的客户域 - 电子邮件帐户) 它接受一个未被识别的字符不是???????但是像
这样的东西זוהי ×¤× ×™×” בקשר לבדיקת מייל × ×•×¡
正如我在浏览器中通过浏览器说的那样,尽管如此 在这种情况下,语言是希伯来语,您可以在下面的代码中看到主题或正文
这段代码中缺少什么,所以不仅可以在gmail网络邮件中找到它?
<?php
$field_name = $_POST['sender_name'];
$field_telephon = $_POST['sender_telephon'];
$field_email = $_POST['sender_mail'];
$field_Subject = $_POST['sender_Subject'];
$field_message = $_POST['sender_message'];
$StrDivOpen = "<div dir='rtl'>";
$StrDivClose = "</div>";
$StrTableOpen = "<table border='1' style='width:260px; font-family:Arial;'>";
$StrTableClose = "</table>";
$StrTrOpen ="<tr>";
$StrTdOpenHd = "<td style='background-color:#fcf7da; width:100px;'>";
$StrTdOpenCont = "<td style='background-color:#dae3a5; width:130px;'>";
$StrTrClose="</tr>";
$StrTdClose="</td>";
$StrBr = "<br />";
$mail_to = 'v7host@gmail.com';
$subject = 'לקוח HostDns, בשם : '.$field_name." , נושא: ".$field_Subject;
$body_message = $StrDivOpen.$StrTableOpen;
$body_message .= $StrTrOpen.$StrTdOpenHd.'מאת : '.$StrTdClose.$StrTdOpenCont.$field_name.$StrTdClose.$StrTrClose;
$body_message .= $StrTrOpen.$StrTdOpenHd.'טלפון : '.$StrTdClose.$StrTdOpenCont.$field_telephon.$StrTdClose.$StrTrClose;
$body_message .= $StrTrOpen.$StrTdOpenHd.'כתובת מייל : '.$StrTdClose.$StrTdOpenCont.$field_email.$StrTdClose.$StrTrClose;
$body_message .= "<tr><td colspan=2 style='background-color:#1cbfbf;'>תוכן ההודעה : </td></tr><tr><td colspan=2 style='background-color:#81c3b2;'>".$StrBr.$field_message."</td></tr></table></div>";
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$headers .= "Content-type: text/html; charset=ISO-8859-1";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thanks for the post. We will contact you soon..');
window.location = 'contact.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Sending failed. Please send an email to v7host@gmail.com');
window.location = 'contact.html';
</script>
<?php
}
?>
答案 0 :(得分:1)
您需要将编码更改为UTF-8:
Content-type: text/html; charset=utf-8
您正在使用的当前编码(ISO / IEC 8859-1)无法处理来自非西方语言的字符。