显示消息并重置PHPMailer表单

时间:2015-07-26 17:35:02

标签: javascript php html phpmailer

我配置了一个phpmailer来从表单发送信息并且工作得很好但是当发送邮件时显示一个空白页面,上面写着:“感谢您联系我们,我们的一位员工会尽快与您联系” 这是发送代码:

 try {
        if ($_POST['name'] != '' && $_POST['email'] != '' && $_POST['message'] != '') {
        $mail->Body    = $messaje;
        } 

    } catch (phpmailerException $e) { //Catch all kinds of bad addressing
        throw new phpmailerAppException($e->getMessage());
    }

        if(!$mail->send()) {
           echo 'Message could not be sent.';
           echo 'Mailer Error: ' . $mail->ErrorInfo;
           exit;
        }

之后我有了这个:

if (!$mail->send()) {

        echo "Mailer Error: " . $mail->ErrorInfo;
    }


     /*CLIENT MESSAGE*/


        echo 'Thank you for contacting us, one of our associates will contact you soon';

        }else {
            exit();

        }

我想在表单的同一页面中显示该消息并重置表单。 提前致谢 这是我的表格:

<form role="form" id="request_quoute" method="post" action="<?php echo site_url(); ?>/wp-content/themes/sfra/sendMail.php">                 
                    <input class="form-control col-xs-12" id="name" name="name" placeholder="Name" type="text" required>                    
                    <input class="form-control col-xs-12" id="email" name="email" placeholder="Email" type="email" required>                    
                    <textarea class="form-control col-xs-12" rows="5" id="message" name="message" placeholder="Message" style="resize:none" required></textarea>
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="text-align: center">                
                    <button type="submit" id="send-form" class="btn btn-primary contact_button">Send Message</button>
                </div>
            </form>

0 个答案:

没有答案