它发送它们,但不显示发件人的地址,而且该消息只说:
自: 电子邮件: 消息:
...
点击发送按钮后,它会将我带到一个空白站点,并确认已发送电子邮件并显示此信息(我拍了一张屏幕截图):
https://ulozto.sk/!oWQ6domKp/undef-jpg
我的contact.php包含
<?php
$user_name = $_POST['cf_name'];
$email_adress = $_POST['cf_email'];
$message = $_POST['cf_message'];
$mail_to = 'ilona.takacsova@gmail.com';
$subject = 'Predmet '.$field_name;
$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$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('Odoslanie prebehlo v poriadku. Ozveme sa Vám čo najskôr.');
window.location = 'index.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Spojenie zlyhalo. Prosím pošlite nám mail na iljatakacs@gmail.com');
window.location = 'index.html';
</script>
<?php
}
?>
并且index.html中的联系表单的HTML代码是
<form action="contact.php" method="post" class="contact-form">
<div class="col-sm-6 contact-form-left">
<div class="form-group">
<input name="name" type="text" class="form-control" id="name" placeholder="Meno">
<input type="email" name="email" class="form-control" id="mail" placeholder="Email">
<input name="subject" type="text" class="form-control" id="subject" placeholder="Predmet">
</div>
</div>
<div class="col-sm-6 contact-form-right">
<div class="form-group">
<textarea name="message" rows="6" class="form-control" id="comment" placeholder="Zanechajte nám odkaz"></textarea>
<center><button type="submit" class="btn btn-default">Odoslať</button></center>
</div>
</div>
</form>
如何让它发挥作用? TOTAL新手在这里,第一次这样做...感谢您的帮助,非常感谢!