My friend's computer (running the latest version Mojave) is experiencing that bug where mail.app suddenly — randomly? — and automatically takes focus while having his Google-account connected to it. I've seen others with this problem — and that it has been around for a while.

Is there a way to find out what is actually happening? A log file perhaps that shows what prompts the Mail app to take focus by itself? It only seems to happen with Google btw. So could it be something with certain Google accounts that forces Mail app to exhibit this behaviour? Any help or pointers in the right direction is much appreciated!

Suggested fixes to this that I've seen so far, have been elaborate workarounds that really doesn't deal with the problem itself, or even what the problem is.

  • Hi and welcome! apple.stackexchange.com/questions/344223/… apple.stackexchange.com/questions/361383/… these are some related questions. My finding is also that whenever that popup occurs, either or both of my google accounts are offline and are trying to go online. Workaround can be as simple as keeping google accounts using mailbox menu. Pointer to log can be ~/Library/Containers/com.apple.mail/Data/Library/Logs/Mail. I can look into it this weekend. (notify me by @ankiiiiiii)
    – anki
    Sep 4 '19 at 19:52
  • @ankiiiiiii Thanks. I'll see if my friend has any logfiles in that folder (mine is empty). I didn't understand what you meant by «keeping google accounts using mailbox menu» — could you elaborate on that? Anyway... refering to your links — which I thought I read properly before writing my own post — there is a suggestion having to do with Google Calendar notifications that I overlooked. I'll have him try that aswell. Also my post's syntax was heavily edited by IconDaemon. Is that a thing on this forum? Or was he just having a bad day?
    – defmc
    Sep 5 '19 at 12:18
  • I meant to keep google accounts offline using mailbox menu. Lost the word in the long comment. I cannot edit my comment now. Editing is one of the strengths of stackexchange network. Some things left, I will fix them :) Calendar option is popular, but I think it worked when calendar is linked with mail. Now it's purely google login attempt based event
    – anki
    Sep 5 '19 at 12:19
  • 1
    So an update @ankiiiiiii: My friend has turned on logging in the mail.app. So waiting for him to pass me his logfiles. I did some more research in the meantime, and found others reporting from their own mail.app-log that authentification attempts with google servers gives an error that seems to me to have to do with a mechanism google uses to safeguard itself from malicious login-attempts. Im not sure what to think about it yet, but if so — it seems even more complicated than I thought. People also report having heard from apple that they are aware of this — but dont know what to do.
    – defmc
    Sep 6 '19 at 21:26
  • Does this answer your question? Mail App keeps popping up in the background in Mac OS Mojave Aug 4 at 14:41

Copying the answer I wrote for this question, Catalina has NOT solved the problem.

Looking for a solution I tried to activate the logging of the connection status (from Mail menu: Windows -> Connection Status). Examining the log when the Mail app is popping up, I found out these error messages at the exactly same time and on every occurrence of the problem (when the app doesn't pop up the error messages don't show up):

READ Oct 10 20:41:21.323 [kCFStreamSocketSecurityLevelTLSv1_2] -- host:imap.gmail.com -- port:993 -- socket:0x6000003b7de0 -- thread:0x60000322d080
5.659 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
READ Oct 10 20:41:21.427 [kCFStreamSocketSecurityLevelTLSv1_2] -- host:imap.gmail.com -- port:993 -- socket:0x6000003b7de0 -- thread:0x60000322d080
6.659 BAD Invalid SASL argument. z66mb54202756wmc
READ Oct 10 20:41:21.732 [kCFStreamSocketSecurityLevelTLSv1_2] -- host:imap.gmail.com -- port:993 -- socket:0x6000003b7de0 -- thread:0x60000322d080
7.659 NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)

(Just posting the lines containing the errors)

The error messages are present only on the log file of my Gmail account, every other mail account doesn't show any error message. So as many of you, I also think that the problem is due to the Gmail accounts.

Hope this can help to solve the problem in any meaningful way.

  • 1
    Thanks for sharing here aswell. Thats good to know. I wonder what google themselves would have to say about this. Maybe there is something one can do on gmail's end, that can solve or mitigate this?
    – defmc
    Oct 12 '19 at 22:55

Your Google Account needs to reconnect with permissions.

‘I’m not sure but it seems like your Google Account is protected by two factor authentication’

Sign out of Google Account from your computer.

1) Sign in your Google Account in browser

2) Review the third party apps that have access to your Google Account.

3) Remove the ‘macOS’ app that is responsible for connecting your Mac to your Google Account.

4) Sign back in, it will ask the permission again.

  • That might be an answer to those who ask workarounds, but not for the one which wants to investigate the cause. Thus the title.
    – anki
    Sep 5 '19 at 20:35
  • Oh, I omitted that. :| Sep 5 '19 at 20:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .