This is a quick note mostly because I personally don't want to lose this information. I have an iPhone and every so often, my mail application won't connect to certain Gmail accounts. And only Gmail accounts - I never have problems with any other mail account.
The message I get is essentially that the username or password for imap.gmail.com is incorrect. In the past, sometimes logging into the account online and then re-setting up the account on my phone has helped, but today, I tried everything and nothing was working! It was only giving me an error message on the Gmail account I use for this blog.
Finally, I came across a little tip on a message board, to go to this website:
Just followed the simple instructions (trying to access mail from my phone again) and it worked!
This is of course no guarantee that it won't happen again, but it worked, and so I want to save this info and maybe put it out there for anyone else who ever has these stupid iPhone problems.