Recently, my school switched their emailing from their own to Google Hosted Email system. I have other Gmail accounts and I can access them through my iPhone without any problems.
Setting up your Google email account is an easy process, which is thoroughly explained at Gmail Support Site. There are two ways you can access your to Gmail account through your iPhone. One of them is IMAP and the other is using POP access.
The problem I had was a verification problem. Even though, I entered my information correct, it would not verify my account and let me access to my emails. What happens is that it will try to verify the account without SSL, and a minute later it would fail verifying.
From time to time, I’d have the same problem with my old browser, Firefox 2. What I’d do is to change my password through another browser then I’d be able to log in. So i tried the same thing. This actually worked. If you are having the same problem, you can try changing your password.
As Google points out, when you are entering your username, make sure to include your domain address after your username. So it would like this “username@yourdomain.com”.