PhpMailer is quite a cool open source library for sending outgoing mails in PHP. I have used it in a few applications which require sending mails via SMTP.
But sadly, it doesn’t work for GMAIL smtp server, the reason being that GMAIL requires TLS or SSL to send mails.
I found a way to fix this problem.
1) Just prefix your smtp hostname with a ssl://
In this case, your hostname will be ssl://smtp.gmail.com
$this->phpMail->Host = "ssl://smtp.gmail.com";
2) Comment out the following lines of code in class.phpmailer.php
/* if(strstr($hosts[$index], ":"))
list($host, $port) = explode(":", $hosts[$index]);
I guess that would be from Line No: 537 – 539
Save the file and test it out.