/ / Modulo di contatto che non invia per e-mail [duplicato] - php, html, moduli, e-mail, contatto

Modulo di contatto che non invia per email [duplicato] - php, html, moduli, email, contatti

Ok quindi il mio modulo di contatto funzionava bene quando ioprima l'ho codificato nel mio sito Web ma ora dopo alcuni mesi ha appena smesso di inviare e-mail al mio indirizzo. Non sono sicuro che si tratti di un problema con il codice o con la mia e-mail? Ecco il mio modulo di posta corrente ...

<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>";
}


}


?>

risposte:

1 per risposta № 1

Prova con questa intestazione di posta:

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