html + php表单不发送电子邮件

时间:2015-09-07 20:57:46

标签: php html forms contact

我知道这里有很多问题,但我无法弄清楚我做错了什么。表单应发送包含表单数据的电子邮件。

<form class="myform" action="contact.php" method="post">
<p class="nadform">Zapisz sie do naszego klubu!</p>
<input id="in1" class="polefor" name="firstname" type="text"
 placeholder="IMIĘ" /> <input id="in2" class="polefor" name="email"
 type="email" placeholder="ADRES EMAIL" /> <input id="wyślij" 
name="submit" type="submit" value="ZAPISZ SIĘ" />

以下是contact.php:

<?php
$field_name = $_POST['firstname'];
$field_email = $_POST['email'];
$mail_to = 'emailadres';
$subject = 'Message from a site visitor '.$field_name;
$body_message = 'firstname'.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status) { ?>
<script language="javascript" type="text/javascript">
    alert('Dziękujemy za rejestrację.');
    window.location = 'pageadres';
</script>

它不起作用。提前谢谢。

0 个答案:

没有答案