mail () always returns false

0

Good, I'm trying to send data from a form to a gmail, but the mail () function always returns false from my PHP code, but Mercury does send it to me. I'm using XAMPP.

The Mercury is set up following this manual :

This is the form:

<!DOCTYPE html>
<html lang="es">
    <head>
        <meta charset="UTF-8">
        <title>Correo</title>
    </head>
    <body>
        <div>
            <form action="envio.php" method="post">
                <input type="text" name="nombre" placeholder="Nombre" />
                <input type="email" name="email" placeholder="Email" />
                <input type="text" name="Teléfono" placeholder="Telefono" />
                <textarea type="text" name="mensaje" placeholder="Mensaje"></textarea>
                <input type="submit" value="ENVIAR" id="boton" />
            </form>
        </div>
    </body>
</html>

and this is the php file:

<?php
$destino="[email protected]";
$nombre=$_POST["nombre"];
$correo=$_POST["correo"];
$telefono=$_POST["telefono"];
$mensaje=$_POST["mensaje"];

$contenido="Nombre: " . $nombre . "\nCorreo: " . $correo . "\nTeléfono: " . $telefono . "\nmensaje" . $mensaje;
$exito=mail($destino, "Contacto", $contenido);

if($exito){
    echo("Bien");
}else{
    echo("Mal");
}
?>
    
asked by Jopimar 13.12.2017 в 14:24
source

1 answer

0

I see you have:

$correo=$_POST["correo"];

and in the input:

name="email"

/////////////////////////////////////////////// ///////////////////////

For what I suggest you put: (to the variable) $correo=$_POST["email"];

(to input) name="email"

or failing to change it: (to the variable) $correo=$_POST["correo"];

(to input) name="correo"

    
answered by 25.09.2018 в 20:21