Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/01/2014, 08:06
felipe12357
 
Fecha de Ingreso: junio-2010
Mensajes: 168
Antigüedad: 13 años, 10 meses
Puntos: 3
Problema de conexion con phpmailer

Hola a todos, estoy enviando correos mediante php-mailer, el codigo funciona correctamente en el servidor de pruebas, sin embargo cuando lo copio al servidor funcional me aparece el siguiente error:

SMTP -> ERROR: Failed to connect to server: Connection timed out (110)
SMTP Error: Could not connect to SMTP host

El envio lo estoy haciendo mediante GMAIL.

Código PHP:
error_reporting(E_STRICT);
    date_default_timezone_set('America/Toronto');
    require_once('PHPMailer/class.phpmailer.php');
    $mail             = new PHPMailer();
    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->CharSet="utf-8";
    $mail->Host       = "smtp.gmail.com"; // SMTP server
    $mail->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
    $mail->SMTPAuth   = true;                  // enable SMTP authentication
    $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
    $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
    $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
    $mail->Username   = "[email protected]";  // GMAIL username
    $mail->Password   = "micontraseña";            // GMAIL password
    $mail->From = "[email protected]";
    $mail->FromName = "Departamento de Educación Virtual y a Distancia";
    $mail->Subject = "Bienvenidos a Dicom";
    $mail->IsHTML(true);
    $mail->MsgHTML($body);
    $mail->AddAddress("$this->email","Estudiante");
//      $mail->AddAttachment('imagenes/correo.png');      // attachment
    //enlace pruebas
    $body  = 
    " hola mundo";
        
    $mail->Body = $body;
    if(!$mail->Send()) {
      echo "Mailer Error: " . $mail->ErrorInfo.'<br>';
    } else {
      echo "Se ha enviado un correo de validación a: $this->email<br>";
    ?><script>alert("Se ha enviado un correo de validación");</script><?    
    
}

QUE podria estar haciendo mal??