I also have this problem with gmail and imap using Cyber Security (126.96.36.199). I did the second suggestion from planet where I removed and added the gmail account to the OSX mail app and still had the same problem of not authenticating user name and password. Even disabling ESET after this didn't work. So I removed ESET and reinstalled the gmail account and bam its working again.
"...it may be that it has been set up to use the ports usually used for regular IMAP and/or POP."
My mail app is set up to use ports 993 for imap and 587 for smpt as these are what is suggested by gmail.