I need some help. I have a contact formulary for a website, but it isnt sending the email, however the message I programmed to tell its working, popa up right.
Heres the HTML
<!doctype html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, maximum-scale=1.0, minimum-scale=1.0">
<title>Untitled Document</title>
<link href="CSS/Principal.css" rel="stylesheet" type="text/css">
<link href="fonts.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
</header>
<section class="formulario">
<form action="contacto.php" method="post">
<p>
<label for="nombre">Nombre:</label>
<input id="nombre" type="text" name="nombre" placeholder="Nombre, Apellido y/o escuela" required="" />
<label for="email">Email:<br>
</label>
<input id="email" type="email" name="email" placeholder="ejemplo@nightjunkies" required="" />
<label for="mensaje">Mensaje:</label>
<textarea id="mensaje" name="mensaje" placeholder="Mensaje" required> </textarea>
<input id="submit" type="submit" name="submit" value="Enviar" />
</p>
</form>
</section>
</body>
<footer>
<p class="footer">Powered By Xanmaya©
</footer>
</html>
And here`s the PHP used
<?php
$nombre = $_POST['nombre'];
$email = $_POST['email'];
$mensaje = $_POST['mensaje'];
$para = 'villasantdesign@gmail.com';
$titulo = 'ASUNTO DEL MENSAJE';
$header = 'From: ' . $email;
$msjCorreo = "Nombre: $nombre\n E-Mail: $email\n Mensaje:\n $mensaje";
if ($_POST['submit']) {
if (mail($para, $titulo, $msjCorreo, $header)) {
echo "<script language='javascript'>
alert('Mensaje enviado, muchas gracias.');
window.location.href = 'http://nightjunkies.com.mx';
</script>";
} else {
echo 'Falló el envio';
}
}
?>
Ill appreciate some help
Finally I fixed it using PHPMailer instead
<?php
require 'phpmailer/PHPMailerAutoload.php';
if(isset($_POST["submit"] ))
{
$nombrede = "Administrador";
$de = 'example@domain.com';
$nombre = $_POST["nombre"];
$email = $_POST["email"];
$mensaje = $_POST["mensaje"];
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp1.example.net';
$mail->SMTPAuth = true;
$mail->Username = 'example@mydomain.com';
$mail->Password = 'password';
$mail->Port = 80;
$mail->From = $email;
$mail->FromName = $nombre;
$mail->addAddress($de, $nombrede);
$mail->Subject = "Contacto Night Junkies";
$mail->Body = $mensaje;
if($mail->Send())
{
echo "<script language='javascript'>
alert('Mensaje enviado, muchas gracias.');
window.location.href = 'http://nightjunkies.com.mx';
</script>";
} else {
echo 'Hubo un problema';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
}
?>