If Gmail stops working with Apple Mail,or other IMAP programs,use the unlock captcha:
This may be a necessary step when configuring a Google Apps account on Mail.app. I needed to run this because I was frequently switching between different ISP’s without closing my mail program. The mail error reported there were too many requests for the account, and the Gmail account became unavailable. You may not need to run the captcha, but it seems to help solve this issue.