Guest User

Untitled

a guest
May 24th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
  3. $Nombre = $_POST['Nombre'];
  4. $Email = $_POST['Email'];
  5. $Mensaje = $_POST['Mensaje'];
  6. $Telefono = $_POST['Telefono'];
  7.  
  8. if ($Nombre=='' || $Email=='' || $Mensaje=='' || $Telefono==''){
  9.  
  10. echo "<script>alert('Los campos marcados con * son obligatorios');location.href ='javascript:history.back()';</script>";
  11.  
  12. }else{
  13.  
  14.  
  15. require("archivosformulario/class.phpmailer.php");
  16. $mail = new PHPMailer();
  17. $mail->From = $Email;
  18. $mail->FromName = $Nombre;
  19. $mail->AddAddress("[email protected]"); // Dirección a la que llegaran los mensajes.
  20.  
  21. // Aquí van los datos que apareceran en el correo que reciba
  22. //adjuntamos un archivo
  23.  
  24. $mail->WordWrap = 50;
  25. $mail->IsHTML(true);
  26. $mail->Subject = "Comentarios Tiendas El Golazo";
  27. $mail->Body = "Nombre: $Nombre n<br />".
  28. "Email: $Email n<br />".
  29. "Mensaje: $Mensaje n<br />".
  30. "Telefono: $Telefono n<br />";
  31.  
  32. // Datos del servidor SMTP
  33.  
  34. $mail->IsSMTP();
  35. $mail->Host = "ssl://smtp.gmail.com:465"; // Servidor de Salida.
  36. $mail->SMTPAuth = true;
  37. $mail->Username = "[email protected]"; // Correo Electrónico
  38. $mail->Password = "pwd"; // Contraseña
  39.  
  40. if ($mail->Send())
  41. echo "<script>alert('Formulario enviado exitosamente, le responderemos lo más pronto posible.');
  42. location.href ='contactanos.html';
  43. </script>";
  44.  
  45. else
  46. echo "<script>alert('Error al enviar el formulario');location.href ='javascript:history.back()';</script>";
  47.  
  48. }
  49.  
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment