I have a contact form, the problem is that it does not send the message, I have already looked at spam and others and I have no idea why it is not sent
I put the code. (to perform the tests, I upload it to a hostinger server)
contact.php
<?php
$nombre = $_POST['nombre'];
$email = $_POST['email'];
$mensaje = $_POST['mensaje'];
$para = "[email protected]";
$titulo = "CONTACTO DESDE WEB";
$headers = array("From: " .$email,
"Reply-To: [email protected]",
"X-Mailer: PHP/" . PHP_VERSION
);
$headers = implode("\r\n", $headers);
$msjCorreo = "Nombre:" .$nombre ."\n E-Mail:" .$email ."\n Mensaje:\n" .$mensaje;
if ($_POST['submit']) {
if (@mail($para, $titulo, $msjCorreo, $headers)) {
echo "
<script language='javascript'>
alert('Mensaje enviado, muchas gracias.');
window.location.href = 'http://..web../index.html#contact';
</script>";
} else {
echo "
<script language='javascript'>
alert('Mensaje enviado, muchas gracias.');
window.location.href = 'Falló el envio';
</script>";
}
}
?>
index.html
<div class="col-lg-6 col-sm-5 wow fadeInUp delay-05s">
<div class="form">
<form action="contacto.php" method="post">
<input class="input-text" type="text" name="nombre" value="Nombre y apellidos *" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;">
<input class="input-text" type="text" name="email" value="E-mail *" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;">
<textarea class="input-text text-area" name="mensaje" cols="0" rows="0" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;">Mensaje *</textarea>
<input class="input-btn" type="submit" name="submit" value="Enviar">
</form>
</div>
</div>