提交表单后有关向用户发送确认电子邮件的问题

时间:2018-12-17 23:51:28

标签: php html forms

由于某种原因,我的表单已停止工作。它说表格已经成功提交了,但是我不再收到电子邮件了。这种情况与先前的问题不同,因为我的代码实际上在某个时间点起作用。所以我只是想看看是什么使它停止工作。

我已经与GoDaddy交谈过,服务器没有问题。他们还能够创建和测试他们收到测试电子邮件的表单,但是我也从未收到过该电子邮件。我已经检查了垃圾邮件/垃圾文件夹,并且电子邮件工作正常。

有人知道这个问题可能是什么吗,我在下面插入了我的PHP和Form代码。

我们将不胜感激。

这是我的contact.php代码:

<?php 
  if(isset($_POST['email'])){

    $name =$_POST["name"];
    $from =$_POST["email"];
    $comment=$_POST["comment"];

    // Email Receiver Address
    $receiver="info@kierrejordan.com";
    $subject="Contact Request from AONB.COM";

    $message = "
    <html>
    <head>
    <title>HTML email</title>
    </head>
    <body>
    <table width='50%' border='0' align='center' cellpadding='0' cellspacing='0'>
    <tr>
    <td colspan='2' align='center' valign='top'><img style=' margin-top: 15px; ' src='http://www.kierrejordan.com/images/logo.png' ></td>
    </tr>
    <tr>
    <td width='50%' align='right'>&nbsp;</td>
    <td align='left'>&nbsp;</td>
    </tr>
    <tr>
    <td align='right' valign='top' style='border-top:1px solid #dfdfdf; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#000; padding:7px 5px 7px 0;'>Name:</td>
    <td align='left' valign='top' style='border-top:1px solid #dfdfdf; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#000; padding:7px 0 7px 5px;'>".$name."</td>
    </tr>
    <tr>
    <td align='right' valign='top' style='border-top:1px solid #dfdfdf; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#000; padding:7px 5px 7px 0;'>Email:</td>
    <td align='left' valign='top' style='border-top:1px solid #dfdfdf; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#000; padding:7px 0 7px 5px;'>".$from."</td>
    </tr>
    <tr>
    <td align='right' valign='top' style='border-top:1px solid #dfdfdf; border-bottom:1px solid #dfdfdf; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#000; padding:7px 5px 7px 0;'>Message:</td>
    <td align='left' valign='top' style='border-top:1px solid #dfdfdf; border-bottom:1px solid #dfdfdf; font-family:Arial, Helvetica, sans-serif; font-size:13px; color:#000; padding:7px 0 7px 5px;'>".nl2br($comment)."</td>
    </tr>
    </table>
    </body>
    </html>
    ";
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <'.$from.'>' . "\r\n";
   if(mail($receiver,$subject,$message,$headers))  
   {
       //Success Message
      echo "The message has been sent!";
   }
   else
   {    
     //Fail Message
      echo "The message could not been sent!";
   }

}
?>

这是我的表单代码:

 <!-- form -->
                    <form id="contactusform" action="javascript:void(0)" method="post">
                        <div class="col-md-10 col-sm-12 center-col">
                            <div class="row"><div class="col-md-12 col-sm-12"><div class="wide-separator-line margin-ten"></div></div>
                                <div class="col-md-12 col-sm-12"><div id="success"></div></div>
                            </div>
                            <div class="col-md-6 col-sm-12">
                                <input name="name" type="text" placeholder="Your Name" />
                                <input name="email" type="text" placeholder="Your Email"  />
                            </div>
                            <div class="col-md-6 col-sm-12">
                                <textarea name="comment" placeholder="Your Message. Desired training date?" ></textarea>
                            </div>
                            <div class="col-md-12 col-sm-12">
                                <div class="col-md-6 col-sm-6 no-padding-left"><span class="required">*Please complete all fields correctly</span></div>
                                <div class="col-md-3 col-sm-6 f-right no-padding-right"><input id="contact-us-button" name="send message" type="button" value="book now" class="btn btn-black no-margin-top f-right no-margin-lr"></div>
                            </div>
                        </div>
                    </form>
                    <!-- end form -->

0 个答案:

没有答案