Guest User

Untitled

a guest
Jan 16th, 2019
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. <?php session_start();
  2.  
  3. require 'conexion.php';
  4.  
  5. $email = $_POST ['email'];
  6. $dni = $_POST ['dni'];
  7.  
  8. $sql = $conexion->prepare("SELECT * FROM WHAL.MDirecciones WHERE email = :E_Mail AND dni = :Nro_Documento");
  9. $sql ->execute(array(
  10. ':E_Mail'=>$email,
  11. ':Nro_Documento'=>$dni,
  12. ));
  13.  
  14. $resultado = $sql ->fetch();
  15.  
  16.  
  17. if ($resultado == true){
  18. $mail->setFrom('aca va el mail', 'nombre del emisor');
  19. $mail->addAddress($email, '');
  20. $mail->Subject = 'Mensaje de Prueba';
  21. $mail->Body = 'Esto es un mensajito de prueba, saludos.';
  22.  
  23. /* SMTP parameters. */
  24. $mail->SMTPDebug=1;
  25. /* Tells PHPMailer to use SMTP. */
  26. $mail->isSMTP();
  27.  
  28. /* SMTP server address. */
  29. $mail->Host = 'smtp.gmail.com';
  30.  
  31. /* Use SMTP authentication. */
  32. $mail->SMTPAuth = TRUE;
  33.  
  34. /* Set the encryption system. */
  35. $mail->SMTPSecure = 'ssl';
  36.  
  37. /* SMTP authentication username. */
  38. $mail->Username = 'mail del que envia';
  39.  
  40. /* SMTP authentication password. */
  41. $mail->Password = 'password del que envia';
  42.  
  43. /* Set the SMTP port. */
  44. $mail->Port = 465;
  45.  
  46. /* Finally send the mail. */
  47. $mail->send();
  48. echo 'Mensaje se envio correctamente';
  49. header('location:../index.php?envio=1');
  50. }else {
  51. echo "Devuelve False.";
  52. }
  53.  
  54. ?>
Add Comment
Please, Sign In to add comment