dtng25909
2019-02-02 14:47
浏览 85
已采纳

Php电子邮件表单不从Web电子邮件表单发送电子邮件

I am trying to troubleshoot this form. It is not sending reservation requests from the form on the website. Despite showing a message that the form was sent.

I tried editing email and the headers.

<?
//print_r($_POST);

$to = “email@emaildomain.com, {$posting['email']}";
function msg($text){
echo "
    <script type='text/javascript'>
    alert('".$text."');
    top.location.href = 'http://www.aribbq.com';
    </script>
";
exit;
}

function error($text){
echo "
    <script type='text/javascript'>
    alert('".$text."');
    history.go(-1);
    </script>
";
exit;
}

if (!$_POST[date]) {error('Please, insert Date.');}
if (!$_POST[time]) {error('Please, insert Time.');}
if (!$_POST[party]) {error('Please, insert Party.');}
if (!$_POST[reservation_name]) {error('Please, insert Name.');}
if (!$_POST[reservation_email]) {error('Please, insert Email.');}
if (!$_POST[reservation_phone]) {error('Please, insert Phone.');}  
if(isset($_POST['submit'])){
 // then send the form to your email

//$from = ('Reservation from AriBBQ.com'); // sender
$mailheaders = "From: contact@aribbq.com" . "
"; // . "CC: 
design@youremail.com"
$mailheaders .= 'Reply-To: ' . $posting['Email'] . "
";
$subject = "AriBBQ.com Online Reservation";
$body = "
 Contact Name: ".$_POST[reservation_name]." 

"; 
//
$body .= " Email: ".$_POST[reservation_email]." 

"; //
$body .= " =================================================== 

"; //
$body .= "  Book a table 


            Date: ".$_POST[date]." 


            Time: ".$_POST[time]." 


            Party: ".$_POST[party]." 


            Contact Details 


            Name: ".$_POST[reservation_name]." 


            Email: ".$_POST[reservation_email]." 


            Phone: ".$_POST[reservation_phone]." 


            Message: ".$_POST[reservation_message]." 

"; //
$body .= " =================================================== 

"; //


$result = mail($to , $from , $subject , $body , $mailheaders); 
if($result) {msg('Thank you, your reservation has been sent. We 
will send you a confirmation text or call in person.');} // 
else{error('Sending mail is failed. Please try again');} //

} else {
error('No submitted. Please try again');
}

?>

You see the form online at http://aribbq.com/. Click on reservations. Once the email is received, we want to be able to reply to the sender's email address.

2条回答 默认 最新

相关推荐 更多相似问题