Enviando un correo electrónico usando PHPMailer y GMAIL SMTP

He leído todos los ejemplos en la web y todavía no puedo conectarme al GMAIL SMTP. Aquí está el código que estoy ejecutando:

include("phpMailer/class.phpmailer.php"); // path to the PHPMailer class
$mail = new PHPMailer(); 
$mail->IsSMTP(); // send via SMTP

$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "myUsername"; // SMTP username
$mail->Password = "myPassword"; // SMTP password
$mail->SMTPDebug = 1;
$webmaster_email = "[email protected]"; //Reply to this email ID
$email="[email protected]"; // Recipients email ID
$name="SomeonesName"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Me";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
$mail->Body = "Hi,
This is the HTML BODY "; //HTML Body
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
if(!$mail->Send())
{
    echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
    echo "Message has been sent";
}

Intenté configurar el puerto aquí y también tengo la configuración actual con lo siguiente en el archivo class.smtp.php:

$host = "ssl://smtp.gmail.com";
$port = 465;

Sigo recibiendo el mismo error y me he asegurado de que ssl esté habilitado. El error que recibo es:

SMTP -> ERROR: Failed to connect to server: No connection could be made because the target machine actively refused it.(10061)

Respuestas a la pregunta(1)

Su respuesta a la pregunta