无法通过php从联系表单发送邮件

时间:2014-03-17 00:30:20

标签: php jquery contact-form

我正在尝试在我的移动应用上实施联系表单。我正在使用名为“Ffform”的插件,可在此处找到http://www.egrappler.com/ffform-free-jquery-contact-form-plugin-with-validations-amazing-css3-animation/

对于我没有经验的眼睛,一切看起来都不错。当我按下提交按钮时,我得到“您的电子邮件已发送”的成功提示。问题是电子邮件永远不会到达我的收件箱。我基本上不知道问题出在哪里。正如我所提到的,我非常缺乏经验,并且仍然试图绕过这段代码。

非常感谢任何有关识别问题的帮助。

这是表格本身:

<div class="container">
<form class="contact" action="email.php" method="post" id="form">

<div class="row clearfix">
<div class="lbl">
<label for="name">Name</label>
</div>
<div class="ctrl">
<input type="text" id="name" name="name" data-required="true" data-validation="text"
data-msg="Invalid Name" placeholder="Ex: John Donga">
</div>
</div>

<div class="row clearfix">
<div class="lbl">
<label for="email">E-Mail</label>
</div>
<div class="ctrl">
<input type="text" id="email" name="email" data-required="true" data-validation="email"
data-msg="Invalid E-Mail" placeholder="Ex: youremail@domain.com">
</div>
</div>


<div class="row  clearfix">
<div class="span10 offset2">
<input type="submit" name="submit" id="submit" class="submit" value="Send Message">
</div>
</div>
</form>
<div id="success">
Your E-Mail has been sent successfully!</div>
<div id="error">
Unable to send e-mail at the moment, please try later.</div>
<div id="validation">
</div>
</div>

这是php文件的内容。我用自己的电子邮件替换了“my_email @ domain”。

<?php 

$send_email_to = "my_email@domain";
$email_subject = "hei";

$email = $_POST['email'];

$name = $_POST['name'];


$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: ".$email. "\r\n";

$message = "<strong>Email = </strong>".$email."<br>";
$message .= "<strong>Name = </strong>".$name."<br>";  

@mail($send_email_to, $email_subject, $message,$headers);

header('Content-type: text/json');
$return_array['success'] = '1';
echo json_encode($return_array);
die();
?>

如果需要,我会发布javascript

0 个答案:

没有答案