Ever since Apple introduced the Internet Accounts way of setting up email on Apple Mail a few years ago I have been unable to setup my Google Apps account, I've tried looking for similar issues but just can't find a solution anywhere.
The first thing I do is select Google from the list in
System Preferences > Internet Accounts. Then enter my username and password into the google login form. Then enter my 2-step Verification code and accept the permissions request.
Then OS X asks what apps I would like to use with my account. I leave all ticked. Then almost immediately I get this error:
Then I get this the same error for my Notes which also uses IMAP.
I have tried multiple computers and have no issue with iOS setup. Just OS X. I've setup other Google Apps accounts with the exact same DNS settings and don't have this issue with them.