/ / Formularz kontaktowy nie wysyłany na e-mail [duplikat] - php, html, formularze, e-mail, kontakt

Formularz kontaktowy nie wysyła na adres e-mail [duplikat] - php, html, formularze, e-mail, kontakt

Ok, więc mój formularz kontaktowy działał dobrze, kiedy janajpierw zakodowałem go na mojej stronie, ale teraz po kilku miesiącach właśnie przestałem wysyłać e-maile na mój adres. Nie jestem pewien, czy to jest problem z kodem czy z e-mailem? Oto mój obecny formularz e-mail ...

<form action="contact.php" method="POST" value="form" >
<p>Name:</p><br /><input type="text" name="name" maxlength="25" /><br /><br />
<p>Email address:</p><br /><input type="text" name="email" maxlength="50" /><br /><br />
<p>Message:</p><br /><textarea name="contact_text" rows="6" cols="30" maxlength="1000" ></textarea><br /><br />
<input type="submit" name="submit" />
</form>

<?php

if (isset($_POST["name"]) && isset($_POST["email"]) && isset($_POST["contact_text"])) {
$name = $_POST["name"];
$email = $_POST["email"];
$text = $_POST["contact_text"];

if (!empty($name) && !empty($email) && !empty($text)) {

if(strlen($name)>25 || strlen($email)>50 || strlen($text)>1000) {
echo "Sorry, max length for some field has been exceeded.";
} else {

$to = "my.email.address@gmail.com";
$subject = "Contact form submitted";
$body = $text."n".$name;
$headers = "From: ".$email;

if (@mail ($to, $subject, $body, $headers)) {
echo "<h5>Thanks for the message, I will be in touch soon.</h5>";
} else {
echo"<h4>Sorry an error occured, please try again later.</h4>";
}
}

}

else {
echo "<h4>All fields are required.</h4>";
}


}


?>

Odpowiedzi:

1 dla odpowiedzi № 1

Spróbuj użyć tego nagłówka wiadomości:

$headers = "From: webmaster@example.com" . "rn" .
"Reply-To: webmaster@example.com" . "rn" .
"X-Mailer: PHP/" . phpversion();