The emails arrive with my body empty, first I thought it could be the name in the html but that solution did not work and I do not know what I can modify.
<form action="TestMail.php" method="post" name="contact-form" id="main-contact-form">
<div class="form-group">
<input type="text" required placeholder="Nombre" class="form-control" name="nombre" id="name" >
</div>
<div class="form-group">
<input type="email" required placeholder="Email" class="form-control" name="email" id="email" >
</div>
<div class="form-group">
<input type="text" required placeholder="Asunto" class="form-control" name="asunto" id="subject">
</div>
<div class="form-group">
<textarea required placeholder="Mensaje" rows="8" class="form-control" name="mensaje" id="message"></textarea>
</div>
<button class="btn btn-primary" type="submit">Enviar</button>
</form>
<?php
$mail_to = "[email protected]";
$asunto="Contacto desde nuestra web";
$name = $_REQUEST["nombre"];
$email = $_REQUEST["email"];
$subject = $_REQUEST["asunto"];
$message = $_REQUEST["mensaje"];
$content = "Nombres: $name\n";
$content .= "E-mail: $email\n\n";
$content .= "Mensaje:\n$message\n";
$headers = "From: $name <$email>";
$success = mail($mail_to, $asunto, $content, $headers);
if ($success) {
echo "¡Gracias! Tu mensaje ha sido enviado.";
} else {
echo "Oops! Algo salió mal, no pudimos enviar tu mensaje.";
}
?>
what I get is:
Nombres:
E-mail:
Mensaje: