我的网站上有以下代码:
<form method="post" name="myemailform" action="js/formtoemail.php" id="contactform">
<p><label>Name</label><input name="name" type="text" /></p>
<p><label>Email</label><input name="email" type="text" /></p>
<p><label>Message </label><textarea name="message" cols="1" rows="7"> </textarea></p>
<p class="a-center"><a onclick="$('#contactform').hide();$('#success-msg').show();" class="button medium lightblue"><span><span>Submit</span></span></a></p>
</form>
这应该只是将名称,电子邮件和消息传递给.php文件,以便可以通过电子邮件发送数据,然后显示成功消息。
但它似乎没有发送电子邮件。 php如下:
<?php
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];
$email_from = 'email@email.com';
$email_subject = "New Form submission";
$email_body = "You have received a new message from $visitor_email with the user $name.\n". "Here is the message:\n $message".
$to = "user@email.com";
$headers = "From: $email_from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
mail($to,$email_subject,$email_body,$headers);
?>
我做错了什么?