Google Apps IMAP Invalid Credentials failure message fix

When using an imap client for google apps mail, a message containing the following text is received

Your IMAP server wants to alert you to the following: Invalid credentials (Failure)

You may see this error if your account name or password is set up incorrectly. In the case that the credentials are correct, it may be a symtom of an account that is being hit too hard or often, and Google has locked it as a precaution against robots. One thing to check is the frequency in which the imap client checks for new mail- less then 5 minutes can be too fast.

Visit the following link, after tailoring it for the specific domain in question:

https://www.google.com/a/yourdomain.com/UnlockCaptcha

This link needs to be edited to reflect the proper location- replace yourdomain.com with the correct domain name.

For a non-google apps account, the link is

https://www.google.com/accounts/DisplayUnlockCaptcha