Last active
December 15, 2015 07:39
-
-
Save fmagrosoto/5225345 to your computer and use it in GitHub Desktop.
Script sencillo para mandar correos en PHP, usando MAIL como función principal.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* SCRIPT PARA ENVIAR CORREOS DESDE PHP | |
* | |
* Script sencillo para enviar datos de un formulario | |
* por correo mediante MAIL de PHP | |
* | |
* @author: Fernando Magrosoto V | |
* @copyright: Febrero 2000 | |
*/ | |
if(isset($_POST['submit'])){ | |
$nombre = htmlspecialchars($_POST['nombre']); | |
$correo = htmlspecialchars($_POST['correo']); | |
$telefono = htmlspecialchars($_POST['telefono']); | |
$ciudad = htmlspecialchars($_POST['ciudad']); | |
$comentarios = htmlspecialchars($_POST['comentarios']); | |
$subject = "Formulario de contacto de PATY BUENO"; | |
$para = "tucuentadecorreo@valido.ext"; | |
$de = "direccion@remitente.ext"; | |
$mensaje = "Alguien ha enviado un formulario."; | |
$mensaje .= "\n"; | |
$mensaje .= "Aquí están los datos: "; | |
$mensaje .= "\n\n"; | |
$mensaje .= "Nombre: ".$nombre."\n"; | |
$mensaje .= "Correo: ".$correo."\n"; | |
$mensaje .= "Teléfono: ".$telefono."\n"; | |
$mensaje .= "Ciudad: ".$ciudad."\n"; | |
$mensaje .= "Comentarios: ".$comentarios."\n\n"; | |
$mensaje .= "----------------------\n"; | |
$mensaje .= "Guarde este correo para futuras revisiones."; | |
if(mail($para, $subject,$mensaje,"From: $de")){ | |
header("Location: contacto_confirm.html"); | |
exit(); | |
} | |
// fin | |
} else { | |
echo "No se ha enviado ningún form"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment