PHP电子邮件不在firefox上发送和不显示联系表单

时间:2013-06-13 08:09:08

标签: php email

你好,我有点困惑,所以只是问......

  1. 我在弹出框中联系我们表单设置!它在谷歌浏览器上运行良好,但在Firefox上它只显示阴影并且不显示弹出窗口lightbox
  2. 我设置了电子邮件脚本以使用google captcha进行验证(re-captcha),但是当我填写表单并点击发送时,不会出错并提交。
  3. 但我从来没有收到过我的收件箱中的电子邮件..我尝试使用Gmail,Hotmail和其他一些人..

    所以我无法理解问题出在哪里,请任何人检查我的代码并告诉它是我的核心错误或我的服务器错误以及如何解决这些问题。

    这是我的sendmail.php代码:

       <!-- for re-captche -->
     <?php
      require_once('../recaptchalib.php');
      $privatekey = "xxx-xxxxxxxxxxx";
      $resp = recaptcha_check_answer ($privatekey,
                                    $_SERVER["REMOTE_ADDR"],
                                    $_POST["recaptcha_challenge_field"],
                                    $_POST["recaptcha_response_field"]);
    
      if (!$resp->is_valid) {
        // What happens when the CAPTCHA was entered incorrectly
        die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
             "(reCAPTCHA said: " . $resp->error . ")");
      } else {
        if(!$_POST) exit;
        $to         = "###";
        $email      = $_POST['email'];
        $name       = $_POST['name'];
        $message    = $_POST['message'];
    
        $subject    = "You've been contacted by $name";
    
        $content    = "$name sent you a message from your enquiry form:\r\n\n";
        $content   .= "Contact Reason: $message \n\nEmail: $email \n\n";
    
        if(@mail($to, $subject, $content, "From: $email \r\n Reply-To: $email \r\nReturn-Path: $email\r\n")) {
            echo "<h5 class='success'>Message Sent</h5>";
            echo "<br/><p class='success'>Thank you <strong>$name</strong>, your message has been submitted and someone will contact you shortly.</p>";
        }else{
            echo "<h2 class='failure'>Sorry, Try again Later.</h2>";
        }
      }
      ?>
      <!--  For contact us form validation and sending -->
    

1 个答案:

答案 0 :(得分:1)

删除以下内容中的@符号:

//-v
if(@mail($to, $subject, $content, "From: $email \r\n
Reply-To: $email \r\nReturn-Path: $email\r\n")) {

并改为:

if(mail($to, $subject, $content, "From: $email \r\n
Reply-To: $email \r\nReturn-Path: $email\r\n")) {