Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/08/2015, 12:41
Avatar de luisdavid1993
luisdavid1993
 
Fecha de Ingreso: julio-2015
Ubicación: Anaco Venezuela
Mensajes: 78
Antigüedad: 8 años, 10 meses
Puntos: 2
Respuesta: ERROR SMTP: No se pudo conectar con el servidor: la red es inalcanzable (1

ok hice un tiket... me podrias explicar que hay que configurar? soy nuevo en programacion y la verdad no se bien que hacer...

este es mi codigo

Código PHP:
Ver original
  1. <?php
  2.  // This example shows settings to use when sending via Google's Gmail servers.
  3.  //
  4.  
  5. //SMTP needs accurate times, and the PHP time zone MUST be set
  6. //This should be done in your php.ini, but this is how to do it if you don't have access to that
  7.  
  8. require 'PHPMailerAutoload.php';
  9.  
  10. //Create a new PHPMailer instance
  11. $mail = new PHPMailer;
  12.  
  13. //Tell PHPMailer to use SMTP
  14. $mail->isSMTP();
  15.  
  16. //Enable SMTP debugging
  17. // 0 = off (for production use)
  18. // 1 = client messages
  19. // 2 = client and server messages
  20. $mail->SMTPDebug = 2;
  21.  
  22. //Ask for HTML-friendly debug output
  23. $mail->Debugoutput = 'html';
  24.  
  25. //Set the hostname of the mail server
  26. $mail->Host = 'smtp.gmail.com';
  27. // use
  28. // $mail->Host = gethostbyname('smtp.gmail.com');
  29. // if your network does not support SMTP over IPv6
  30.  
  31. //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
  32. $mail->Port = 587;
  33.  
  34. //Set the encryption system to use - ssl (deprecated) or tls
  35. $mail->SMTPSecure = 'tls';
  36.  
  37. //Whether to use SMTP authentication
  38. $mail->SMTPAuth = true;
  39.  
  40. //Username to use for SMTP authentication - use full email address for gmail
  41. $mail->Username = "[email protected]";
  42.  
  43. //Password to use for SMTP authentication
  44. $mail->Password = "clave";
  45.  
  46. //Set who the message is to be sent from
  47. $mail->setFrom('[email protected]', 'No responder');
  48.  
  49. //Set an alternative reply-to address
  50. //$mail->addReplyTo('[email protected]', 'First Last');
  51.  
  52. //Set who the message is to be sent to
  53. $mail->addAddress('[email protected]', 'nombre');
  54.  
  55. //Set the subject line
  56. $mail->Subject = 'PHPMailer GMail SMTP test';
  57.  
  58. //Read an HTML message body from an external file, convert referenced images to embedded,
  59. //convert HTML into a basic plain-text alternative body
  60. $mail->Body = "<h1>Prueba de correo</h1><br><br>Mensaje de prueba mandado por {luis david} con phpmailer en formato html<br>";
  61.  
  62. //Replace the plain text body with one created manually
  63. $mail->AltBody = 'This is a plain-text message body';
  64.  
  65. //Attach an image file
  66. //$mail->addAttachment('images/phpmailer_mini.png');
  67.  
  68. //send the message, check for errors
  69. if (!$mail->send()) {
  70.     echo "Mailer Error: " . $mail->ErrorInfo;
  71. } else {
  72.     echo "Message sent!";
  73. }
  74. ?>


ya habilite IMAP en mi correo de gmail
__________________
"Lucha por tus sueños o alguien te contratara para que cumplas los de el"