Yes. It is happening because the SSL certificate on the server is for pop.gmail.com but you are connecting to imap.gmail.com. The mismatch in hostnames is causing the alert. All your traffic will still be secure.
Also, you might want to click on the "always trust pop.gmail.com..." so you arent asked each and every time.