duanluwei9374 2015-07-21 22:10
浏览 39
已采纳

我必须使用哪种语言来获取PHP邮件表单的成功或错误情况?

I've got a PHP mail form which is already coded :

PHP Mail Form

And I would like to appear a banner i coded using CSS and jQuery, if the form succeed to send a mail, or not :

Success

I would like to know what language could I use to make it happens ? What are your advices ?

Here is my html code for the form :

<form id="my_form" enctype="multipart/form-data" method=POST action=formmail.php>
    <input type="hidden" name="subject" value="formmail">


<!-- PSEUDO -->

<p>

    <h3>
        PSEUDO
        <font class="color-red">
        * :
        </font>
        <span class="padding1"><input type="text" class="form-control" name="pseudo" aria-required="true" aria-invalid="false"></span></p><br>


<!-- EMAIL -->

    <p> 
         EMAIL
         <font class="color-red">
             * :
         </font>
         <span class="your-email padding1"><input type="email" class="form-control" name="email" aria-required="true" aria-invalid="false"></span></p><br>

   <!-- MOTO -->

    <p>
        QUOTE
        <font class="color-red">
        * :
        </font>

    <span class="moto padding1"><input type="moto" class="form-control" name="moto" aria-invalid="false"></span> </p><br>



  <!-- LINK OF THE GIF -->  

<p>
    LINK OF THE GIF
    <font class="color-red">
    * :
    </font>
     <span class="link-url padding1"><input type="link_url" class="form-control" name="link_url" aria-invalid="false"></span> </p><br>


  <!-- RECAPTCHA -->  
    <div align="center">
    <p><div class="g-recaptcha" data-sitekey="6LehFQoTAAAAAMHlOs6vgktrCdFo485AoHwmp9Cp"></div></p><br><h3>


    <!-- SUBMIT -->

<p><input type="image" src="img/submitbutton.png" value="send"/><img class="ajax-loader" src="http://s584101063.onlinehome.fr/wp-content/plugins/contact-form-7/images/ajax-loader.gif" alt="Envoi en cours ..." style="visibility: hidden;"></p></div>


</div>
</form>

Here is my PHP :

if($_SERVER["REQUEST_METHOD"] === "POST")
    {
        //form submitted

        //check if other form details are correct

        //verify captcha
        $recaptcha_secret = "MY_SECRET_RECAPTCHA";
        $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$recaptcha_secret."&response=".$_POST['g-recaptcha-response']);
        $response = json_decode($response, true);
        if($response["success"] === true)
        {

            Header("Location: MY_WEBSITE");





            $TO = "MY_MAIL";

$subject = "Submission";

$h = "From: " . $_POST['email'];
 $pseudo = $_POST['pseudo'];
 $email = $_POST['email'];
 $link_url = $_POST['link_url'];
 $moto = $_POST['moto'];

$HTTP_POST_VARS = $_POST;


$message = "Pseudo : " . $pseudo . "

 " . "Email : " . $email . " 

" . "Text : " . $moto . "

 " . "URL du GIF : " . $link_url;

mail($TO, $subject, $message, $h);








        }



        else
        {
            $result
        }
    }


?>
  • 写回答

2条回答 默认 最新

  • dongyouzhui1969 2015-07-21 22:33
    关注

    VERY basic idea:

    $test=mail($TO, $subject, $message, $h);
    
    if($test){
    echo 'EmAIL WORK';
    }else{
    echo 'EmAIL Fail';
    
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作