我的联系表单没有提交或通过电子邮件发送PHP + HTML

时间:2015-02-25 13:33:37

标签: php html email

以下是HTML代码:

<form id="contactform" action="contact/contact.php" method="post" class="validateform" name="send-contact">
  <div id="sendmessage">
     Your message has been sent. Thank you!
  </div>
  <div class="row">
    <div class="col-lg-4 field">
      <input type="text" name="name" placeholder="* Enter your full name" data-rule="maxlen:4" data-msg="Please enter at least 4 chars" />
      <div class="validation">
      </div>
    </div>
    <div class="col-lg-4 field">
      <input type="text" name="email" placeholder="* Enter your email address" data-rule="email" data-msg="Please enter a valid email" />
      <div class="validation">
      </div>
    </div>
    <div class="col-lg-4 field">
      <input type="text" name="subject" placeholder="Enter your subject" data-rule="maxlen:4" data-msg="Please enter at least 4 chars" />
      <div class="validation">
      </div>
    </div>
    <div class="col-lg-12 margintop10 field">
      <textarea rows="12" name="message" class="input-block-level" placeholder="* Your message here..." data-rule="required" data-msg="Please write something"></textarea>
      <div class="validation">
      </div>
      <p>
        <button class="btn btn-theme margintop10 pull-left" type="submit">Submit message</button>
        <span class="pull-right margintop20">* Please fill all required form field, thanks!</span>
      </p>
    </div>
  </div>
</form>

这是PHP代码:

<?php
/*
Credits: Bit Repository
URL: http://www.bitrepository.com/
*/

include 'config.php';

error_reporting (E_ALL ^ E_NOTICE);

$post = (!empty($_POST)) ? true : false;

if($post)
{

$name = stripslashes($_POST['name']);
$email = trim($_POST['email']);
$subject = stripslashes($_POST['subject']);
$message = stripslashes($_POST['message']);

$error = '';

if(!$error)
{
$mail = mail(WEBMASTER_EMAIL, $subject, $message,
     "From: ".$name." <".$email.">\r\n"
    ."Reply-To: ".$email."\r\n"
    ."X-Mailer: PHP/" . phpversion());


if($mail)
{
echo 'OK';
}

}


}
?>

当我点击页面上的提交没有任何反应时,没有电子邮件发送任何第二意见或另一双眼睛请看它吗?我认为它可能是PHP的一个问题,但我不是100%肯定。 任何帮助都会谢谢!

0 个答案:

没有答案