請任何人蔘考此代碼,併爲我糾正它。 我在其他正在工作的網頁中使用了此代碼,但現在此腳本未發送該消息,它顯示了我的自定義錯誤消息。PHP電子郵件顯示錯誤
能否請你任何一個可以幫助我找到問題
謝謝
<?php
/* for admin */
$registration_subject="Live demo registration";
$registration_office="[email protected]";
/* REGISTER details */
$bizname = $_POST['txtbizname'];
$biztype = $_POST['cbobiztype'];
$address = $_POST['TxtAddress'];
$city = $_POST['TxtCity'];
$country = $_POST['cboCountry'];
$tel = $_POST['TxtTel'];
$fax = $_POST['TxtFax'];
$email = $_POST['TxtEmail'];
$web = $_POST['TxtWeb'];
$title = $_POST['Cbotitle'];
$contname = $_POST['txtcontname'];
$designation = $_POST['TxtDesignation'];
$mob = $_POST['TxtMob'];
$contemail = $_POST['TxtcontEmail'];
$callbiztime = $_POST['BizGMT'];
$body = <<<EOD
Business Name : $bizname <br>
Business Type : $biztype <br>
Address : $address <br>
City : $city <br>
Country : $country <br>
Tel : $tel <br>
Fax : $fax <br>
Email : $email <br>
Web : $web <br>
Title : $title <br>
Contact Person Name : $contname <br>
Designation : $designation <br>
Mobile : $mob <br>
Email : $contemail <br>
Call Me at : $callbiztime <br>
EOD;
$headers = "From : $email\r\n";
$headers = "Content-type:text/html\r\n";
$mail_status = mail($registration_office, $registration_subject, $body, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'b2b.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to [email protected]');
windowwindow.location = 'b2b.html';
</script>
<?php
}
?>
它顯示'消息失敗。請發送....信息?或者你的意思是什麼「自定義錯誤信息」? – sebastian
你在localhost上測試它嗎?你有測試它的SMTP服務器嗎? – Wallack
這是你的郵件服務器的問題,而不是代碼。 –