Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/05/2010, 12:17
den_22
 
Fecha de Ingreso: enero-2010
Mensajes: 198
Antigüedad: 14 años, 4 meses
Puntos: 1
Phpmailer no me funciona

Hola amigos, estoy tratando de enviar un mail con phpmailer pero no me funciona me dice "SMTP Error: Could not connect to SMTP host. "
No se que puedo estar haciendo mal, alguien me podria decir?.

form:

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
  3. <title>enviar</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5.  
  6. </head>
  7. <form id="form1" name="form1" method="post" action="enviando.php">
  8. <p>Nombre:<br />
  9. <input name="nombre" type="text" id="nombre" />
  10. <br />
  11. Telefono:<br />
  12. <input name="telefono" type="text" id="telefono" />
  13. <br />
  14. Email:<br />
  15. <input name="email" type="text" id="email" />
  16. <br />
  17. Mensaje:<br />
  18. <textarea name="mensaje" id="mensaje"></textarea>
  19. <br />
  20. <input type="submit" name="Submit" value="Enviar Formulario" />
  21. </p>
  22. </form>
  23. </body>
  24. </html>


enviando.php:

Código PHP:
Ver original
  1. <?php
  2. require("class.phpmailer.php");
  3. $mail = new phpmailer();
  4.  
  5.  
  6. $mail->Mailer = "smtp";
  7. $mail->Host = "smtp.aol.com";
  8. $mail->SMTPAuth = true;
  9. $mail->Username = "[email protected]";
  10. $mail->Password = "xxxxx";
  11. $mail->From = "[email protected]";
  12. $mail->FromName = "den_22";
  13.  
  14. $mail->Timeout=30;
  15.  
  16. $mail->AddAddress("[email protected]");
  17.  
  18.  
  19. $mail->Subject = "Prueba de phpmailer";
  20. $mail->Body = "<b>Mensaje de prueba mandado con phpmailer en formato html</b>";
  21.  
  22. $mail->AltBody = "Mensaje de prueba mandado con phpmailer en formato solo texto";
  23.  
  24. $exito = $mail->Send();
  25.  
  26. $intentos=1;
  27. while ((!$exito) && ($intentos < 5)) {
  28. sleep(5);
  29. //echo $mail->ErrorInfo;
  30. $exito = $mail->Send();
  31. $intentos=$intentos+1;
  32.  
  33. }
  34.  
  35.  
  36. if(!$exito)
  37. {
  38. echo "Problemas enviando correo electrónico a ".$valor;
  39. echo "<br/>".$mail->ErrorInfo;
  40. }
  41. else
  42. {
  43. echo "Mensaje enviado correctamente";
  44. }
  45. ?>