使用phpgap内部的联系表单提供成功警报,但无法找到邮件

时间:2014-04-04 13:29:18

标签: javascript php jquery email cordova

基本上问题是堆栈溢出中前一个问题的mirror。此表单有效,但在成功提醒后,我找不到发送到指定电子邮件ID的邮件。

点击发送按钮后,如果我获得成功提醒,这意味着邮件已成功发送,但当我检查name@example.com(虚拟)时,我应该看到收件箱中的邮件,但无法找到邮件。可能是什么问题。我做错了吗?

contact.html

 <html>
    <head>
    <link rel = "stylesheet" href="css/theme.min.css"/>
    <link rel="stylesheet" href="css/jquery.mobile-1.2.1.css"/>
    <script type="text/javascript" charset="utf-8" src="js/jquery-1.6.1.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8" src="js/jquery.mobile-1.2.1.min.js"></script>
    <script type="text/javascript">
    // When the document has loaded...
    $(document).ready(function() {
      // Bind this action as a function to be executed when the button is clicked...
      $('input[type="button"][value="send"]').click(function() {
        $.post('http://www.techmagzine.com/contact_us.php', {

          // These are the names of the form values
          // EDIT: You have the wrong ids on these...

          FirstName: $('#txtfullname').val(),
          LastName: $('#txtemail').val(),
          Email: $('#txtcontact').val(),
          MessageText: $('#txtmessage').val()

          // HTML function

          }, function (html) {
              // Place the HTML in a astring
              var response=html;

              // PHP was done and email sent
              if (response=="success") {
                alert("Message sent!"); 
                clear();
              } else {

                // Error postback
                alert("Please fill all fields!"); 
                return false;
              }
        });
      });
    });
    </script>
    </head>
    <body>
    <div data-role="page" id="front" data-theme="b">
      <div class="header" id="header" data-role="header">
       <h3>Contact-Us</h3>
      </div>

      <div data-role="content">

            <label for="txtfullname">Firstname</label>
            <input id="txtfullname" name="FirstName" type="text" placeholder="required" required />

            <label for="txtemail">Lastname</label>
            <input id="txtemail" name="LastName" type="text" placeholder="required" required  />

            <label for="txtcontact">Email</label>
            <input id="txtcontact" name="Email" type="email" placeholder="required" required />

            <label for="txtmessage">Message</label>
            <textarea id="txtmessage" name="MessageText" placeholder="required" rows="10" required ></textarea>

          <input type="button" value="send"/>



      </div>
      </div>

    </body>
    </html>

contact_us.php

<?php

    // VARS
    $FirstName=$_POST["FirstName"];
    $LastName=$_POST["LastName"];
    $Email=$_POST["Email"];
    $MessageText=$_POST["MessageText"];
    $Headers = "From:" . $Email;

    //VALIDATION
    if(
    $FirstName=="" ||
    $LastName=="" ||
    $Email=="" ||
    $MessageText==""
    ) {
        echo "Error";
    } else {
        mail("name@example.com","mobile app message",$MessageText, $Headers);
        echo "success";
    }
?>

0 个答案:

没有答案