I have came across the same issue and both my User name and password were correct. Fortunately I was able to resolve it by doing following changes to the parameters passed in. (I'm using a my google app domain herewith)
Normally these 2 parameters look like this.
$smtp->user="
[email protected]";
/* Set to the user name if the server requires authetication */
$smtp->realm="";
This gave me the exact error you've given. So I changed that to this (after sniffing around for few hours ;-))
$smtp->user="keerthi";
/* Set to the user name if the server requires authetication */
$smtp->realm="mydomain.com";
Ta da.. it worked, I don't know what is the internal stuff going wrong with the old settings, but this resolved my issue.
Hope this will be useful for someone since this thread is some what old.