Mail: all accounts set to offline but still receive emails
You can define your firewall to block mail.app when activated, then toggling it on/off when needed.

You could also use another app (like Radio Silence) to only block mail.app and keep your firewall running (and I'd personnaly go with that solution). I don't believe Radio Silence has a shortcut but it's really easy to set up &amp; use (literraly launch Radio Silence, drag Mail.app into it and toggle on/off button when needed).



If you prefer to set up an automator script to enable/disable the firewall to block mail.app
First of all set the firewall to block Mail.app:

Go to System Preferences -&gt; Security and Privacy -&gt; Firewall
Click on the lock on the bottom left to make change
Click on &quot;Firewall Option...&quot;
Click on  +  and add &quot;Mail.app&quot;, then choose &quot;block incoming connections&quot; (like transmission in the picture below)


After that, you can use this script to toggle the firewall:
(this AppleScript allows a user to turn on or off the built in firewall. The script reads and then displays the current state and then presents an option for changing that status. The change happens immediately but the Systems Preference pane needs to be closed out and reopened in order to visually see that change. I found it here)
set firewallState to do shell script &quot;defaults read /Library/Preferences/com.apple.alf globalstate&quot;
if firewallState = &quot;0&quot; then
    set firewallStatus to &quot;The firewall is currently set to off (or allow all incoming connections)&quot;
else if firewallState = &quot;1&quot; then
    set firewallStatus to &quot;The firewall is currently set to allow access for specific services and applications&quot;
else if firewallState = &quot;2&quot; then
    set firewallStatus to &quot;The firewall is currently set to allow only essential services&quot;
end if

#change status of the firewall: 0=off 1=on for specific services and 2=on for essential services

display dialog firewallStatus &amp; return &amp; return &amp; &quot;Do you want to enable the firewall?&quot; buttons {&quot;Cancel&quot;, &quot;Turn Firewall Off&quot;, &quot;Turn Firewall On&quot;} default button 1 with icon 2
set the userChoice to the button returned of the result

if the userChoice is &quot;Turn Firewall Off&quot; then
    do shell script &quot;defaults write /Library/Preferences/com.apple.alf globalstate -int 0&quot; with administrator privileges
end if

if the userChoice is &quot;Turn Firewall On&quot; then
    do shell script &quot;defaults write /Library/Preferences/com.apple.alf globalstate -int 1&quot; with administrator privileges
end if

Finally, you can save it into an .command and active it by a click or use terminal with osascript /Users/USERNAME/Desktop/YOURSCRIPT.applescript
Or set up Automator to create a Mac Application that you can double click, add to the dock, etc.:

Open Automator application
Choose &quot;Application&quot; type
Type &quot;run&quot; in the Actions search box
Double click &quot;Run Shell Script&quot;
Click the Run button in upper right corner to test it.
File &gt; Save to create the Application.