无法通过联系表单接收电子邮件,这是我的代码

时间:2015-09-20 19:35:22

标签: php ajax

我无法接收电子邮件。这是我的代码。我正在尝试找到我的错误,但我无法找到。所以有人帮我解决这个问题。我对我的代码感到怀疑。我在我的php文件中的代码。我的邮件()  函数返回true,我修改了我的xamp配置文件。

  <?php
    require("connection.php");
    ?>
    <?php

      if(isset($_REQUEST))
      {
          $first = $_REQUEST['firstname'];
          $middle = $_REQUEST['middlename'];
          $last = $_REQUEST['lastname'];
          $email = $_REQUEST['email'];
          $phone = $_REQUEST['phone'];
          $message =$_REQUEST['message'];
          $query=" INSERT INTO `contact`(`id`,`first-name`, `middle-name`, `last-name`, `email`, `phone`, `message`) VALUES ('','$first','$middle','$last','$email','$phone','$message')";
          $result = mysql_query($query);
          if($result)
          {
            echo "data entered";
          }
          else
          {
            echo "data is not entered";
          }




          $to = "mehmood.asif31@gmail.com";
          $subject = "Message From Contact Us Page";

          $headers = "From:mehmood.asif31@gmail.com \r\n";
          $headers .= "Bcc:mehmood.asif31@gmail.com \r\n";
          $message = '<div style="margin:0 auto; padding:0px;  width:800px">
                              <p style="font:bold 28px Arial, Helvetica, sans-serifl ; color:#006699; padding:0 0 0px 0; ">Feedback Message</p>

                              <div style=" margin:0 0 20px 0; font-family:Arial, Helvetica, sans-serif; font-size:15px; padding:10px; margin:0px; line-height:22px;">
                              <table>
                                  <tr>
                                      <td><strong>Name:</strong></td>
                                      <td>'.$first.'</td>
                                  </tr>
                                  <tr>
                                      <td><strong>Email ID:</strong></td>
                                      <td>'.$email.'</td>
                                  </tr>
                                  <tr>
                                      <td><strong>Phone No:</strong></td>
                                      <td>'.$phone.'</td>
                                  </tr>
                                  <tr>
                                      <td><strong>Message:</strong></td>
                                      <td>'.$message.'</td>
                                  </tr>


                              </table>

                  </div>

                              </div>';

            //echo $message; exit;
          mail($to, $subject, $message, $headers);




          unset($_POST);
      }
    ?>

0 个答案:

没有答案