我已经为我的网站创建了一个简单的联系表,并对其进行了设置,以便在邮件通过时将其写在“ mailsent”链接中。它确实写有“已发送邮件”,但我实际上没有收到电子邮件。
<?php
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$mailFrom = $_POST['mail'];
$message = $_POST['message'];
$mailTo = "myemail@email.com";
$headers = "From: " . $mailFrom;
$txt = "You have received an e-mail from " . $name . ".\n\n" . $message;
mail($mailTo, $txt, $headers);
header("Location: index.php?mailsent");
}
?>