How to make Mail not to open it's window automatically? I always keep the Mail application running in the background (there is a dot below the Mail icon in the Dock but a Mail window is not open) to get notifications about new messages. When I finish work, I don't turn my MacBook off, I make it sleep by shutting the screen pane down. Every time I awake the MacBook in the morning, a Mail window opens as soon as an Internet connection is established. It is very annoying. How to prevent Mail from opening the window on the day first login?

The «Open at Login» option is not turned off in the Mail context menu in the Dock. The Mail application is not listed in «System Preferences» – «Users &amp; Groups» – «Login items».

Environment:


MacBook Pro 13" 2012, MacBook Pro 15" 2015
macOS 10.13.4, 10.15.2
Mail 11.3, 13.0


Update. Starting from macOS 10.14 Mail opens not only on login but occasionally with no apparent reason (it is very annoying when I'm using a fullscreen application).
This has been an ongoing issue since I got my first Mac way back in 2014. There are a lot of window related issues with mail, but they haven't been resolved for years and probably never will be. Sorry to tell you you're going to have to get used to it. Another annoying problem I've experienced with every Mac I've ever used now is if you have a Mail message open in its' own window but not the main window and you click the Mail icon in the dock it'll open the main window on top of the message window. Intuitive!