0

你好这对我来说有点困惑所以只是问..

  1. 我在弹出框上有一个联系我们的表单设置!它在 google chrome 上运行良好,但在 Firefox 上它只显示一个阴影而不显示弹出窗口lightbox
  2. 我已经设置了google captcha用于验证的电子邮件脚本(re-captcha),但是当我填写表格并单击发送时,它不会给出错误并提交。

但我从来没有在我的收件箱中收到过电子邮件。我尝试过使用 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 -->
4

1 回答 1

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")) {
于 2013-06-13T09:17:34.457 回答