I just got my new macbook air three weeks ago and since then been going crazy with this issue.
I added my gmail account to apple mail and it's been acting up ever since. At times it won't connect to the SMTP server (out going messages) and at times it won't connect to the IMAP (incoming messages). One of the issues is that the SMTP connection keeps going off-line and I have no idea why. Tried everything my friends/internet provider/Apple support suggested (uninstalled and reinstalled, edited the server list and added a new one - everything) but nothing worked.
I read in some forums that the problem is with the new Lion releasae but there was no mention for a fix.
If anyone can help me I sure would appreciate it. Otherwise I see no alternative but a trip to the store...