简体   繁体   English

PHP电子邮件未发送且在Firefox上未显示联系表单

[英]PHP email not sending and not displaying contact form on firefox

Hello its bit confusing for me so just asking.. 你好,这让我有点困惑,所以问一下。

  1. I have a contact us form setup on pop-up box ! 我在弹出框上有联系我们表格的设置! Its working fine on google chrome but on Firefox it just show a shadow and don't display the pop-up lightbox . 它可以在google chrome上正常工作,但在Firefox上仅显示阴影而不显示弹出式lightbox
  2. I have setup email script to use google captcha for verification ( re-captcha ) , but when i fill form and click send it don't give error and submit. 我已经设置了电子邮件脚本来使用google captcha验证google captcha进行验证( re-captcha ),但是当我填写表格并单击“发送”时,不要给出错误并提交。

but i never receive email at my inbox.. i tried with Gmail , Hotmail and few others.. 但是我从未在收件箱中收到电子邮件。.我尝试使用Gmail,Hotmail和其他一些邮件。

So i can't understand where the problem is, Please can anyone check my code and tell is its my core error or its my server error and how to fix these issues. 所以我不明白问题出在哪里,请任何人可以检查我的代码并告诉它我的核心错误或服务器错误以及如何解决这些问题。

Here goes my sendmail.php code: 这是我的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 -->

Remove the @ symbol in: 删除以下位置的@符号:

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

and change to: 并更改为:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM