Hey everyone. I think I found a fix or at least it's working for me.
I have only two email accounts on my computer - an exchange server for work and a gmail for my personal email. Mail was popping up randomly and it was becoming super annoying. Once, it popped up during a presentation. I was less than thrilled.
My solution:
Delete your Gmail account from your Internet Accounts in System Preferences. I don't use my Google Calendar too much so I wasn't worried about losing it from the Calendar app so this might be a bummer for those who rely on their Google Calendar if they are using it in the Calendar app. You might be able to add your Google Calendar separately, but I've tried a couple of things setting it up as a CalDAV account but I haven't had much luck yet.
So I added my Gmail in the options where it asks to "Add Other Account..." and chose Mail Account. When I went to sign in, I was getting an error that my user name and password were incorrect. That's where I found somewhere online that I need to go to https://myaccount.google.com/lesssecureapps and turn this on. Once I did that, I was able to sign in through mail with my Gmail username and password and all my mail was instantly back.
Haven't had Mail popup since.
Hope that helps.