Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. require_once('mail/class.phpmailer.php');
  2. require_once ('mail/PHPMailerAutoload.php');
  3.  
  4. $mail = new PHPMailer();
  5. //indico a la clase que use SMTP
  6. $mail ->IsSMTP();
  7. //permite modo debug para ver mensajes de las cosas que van ocurriendo
  8. $mail ->SMTPDebug = 2;
  9. //Debo de hacer autenticación SMTP
  10. $mail ->SMTPAuth = true;
  11. $mail ->SMTPSecure = "ssl";
  12. //indico el servidor de Gmail para SMTP
  13. $mail ->Host = "smtp.gmail.com";
  14. //indico el puerto que usa Gmail
  15. $mail ->Port = 465;
  16. //indico un usuario / clave de un usuario de gmail
  17. $mail ->Username = "correo@gmail.com";
  18. $mail ->Password = "*******";
  19. $mail ->SetFrom('correo@gmail.com', 'Nombre completo');
  20. $mail ->AddReplyTo("correo@gmail.com","Nombre completo");
  21. $mail ->Subject = "Envío de email usando SMTP de Gmail";
  22. $mail ->MsgHTML("Hola que tal, esto es el cuerpo del mensaje!");
  23. //indico destinatario
  24. $address = "destino@gmail.com";
  25. $mail ->AddAddress($address, "Nombre completo");
  26. if(!$mail ->Send()) {
  27. echo "Error al enviar: " . $mail->ErrorInfo;
  28. } else {
  29. echo "Mensaje enviado!";
  30. }
  31.  
  32. 2017-02-03 15:21:30 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP 13sm9852700uac.20 - gsmtp 2017-02-03 15:21:30 CLIENT -> SERVER: EHLO localhost 2017-02-03 15:21:30 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [190.146.238.90] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 2017-02-03 15:21:30 CLIENT -> SERVER: AUTH LOGIN 2017-02-03 15:21:30 SERVER -> CLIENT: 334 VXNlcm5hbWU6 2017-02-03 15:21:30 CLIENT -> SERVER: ZGVhdGhzdHJva2Vjb2xvbWJpYUBnbWFpbC5jb20= 2017-02-03 15:21:30 SERVER -> CLIENT: 334 UGFzc3dvcmQ6 2017-02-03 15:21:30 CLIENT -> SERVER: MzExNTY4OTExNw== 2017-02-03 15:21:31 SERVER -> CLIENT: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 13sm9852700uac.20 - gsmtp 2017-02-03 15:21:31 SMTP ERROR: Password command failed: 534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 13sm9852700uac.20 - gsmtp 2017-02-03 15:21:31 SMTP Error: Could not authenticate. 2017-02-03 15:21:31 CLIENT -> SERVER: QUIT 2017-02-03 15:21:31 SERVER -> CLIENT: 221 2.0.0 closing connection 13sm9852700uac.20 - gsmtp 2017-02-03 15:21:31 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Error al enviar: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement