Advertisement
Guest User

Untitled

a guest
Sep 8th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. require_once("class.phpmailer.php");
  2. require_once('class.smtp.php');
  3. $mail = new PHPMailer();
  4. $mail­>IsSMTP();
  5. $mail­>SMTPDebug = 2;
  6. $mail­>SMTPAuth = true;
  7. $mail­>SMTPSecure = "ssl";
  8. //indico el servidor de Gmail para SMTP
  9. $mail­>Host = "smtp.gmail.com";
  10. //indico el puerto que usa Gmail
  11. $mail­>Port = 465;
  12. //indico un usuario / clave de un usuario de gmail
  13. $mail­>Username = "usuarioX";
  14. $mail­>Password = "passwordX";
  15. $mail­>SetFrom('correo@gmail.com', 'Nombre');
  16. $mail­>AddReplyTo("correo@gmail.com","Nombre");
  17. $mail­>Subject = "Asunto del correo";
  18. $mail­>MsgHTML("Hola, este es el cuerpo del mensaje!");
  19. //indico destinatario
  20. $address = "correoDestino@gmail.com";
  21. $mail­>AddAddress($address, "Mi nombre");
  22. if(!$mail­>Send()) {
  23. echo "Error al enviar: " . $mail­>ErrorInfo;
  24. }
  25. else {
  26. echo "Mensaje enviado!";
  27. }
  28.  
  29. $mail­>SMTPDebug = 2;
  30.  
  31. $mail­>SMTPAuth = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement