Mail: all accounts set to offline but still receive emails
In Mac Mojave, when I want to focus on work then I switch all email accounts in Mail.app to offline mode. I could of course close the application, for better focus, but can not do it since I need to find reference material in some email folders. But the thing is, even in all accounts are set to offline, I am still getting new emails. How can I fix this?
-
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 & 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 -> Security and Privacy -> Firewall
- Click on the lock on the bottom left to make change
- Click on "Firewall Option..."
- Click on + and add "Mail.app", then choose "block incoming connections" (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 "defaults read /Library/Preferences/com.apple.alf globalstate"
if firewallState = "0" then
set firewallStatus to "The firewall is currently set to off (or allow all incoming connections)"
else if firewallState = "1" then
set firewallStatus to "The firewall is currently set to allow access for specific services and applications"
else if firewallState = "2" then
set firewallStatus to "The firewall is currently set to allow only essential services"
end if
#change status of the firewall: 0=off 1=on for specific services and 2=on for essential services
display dialog firewallStatus & return & return & "Do you want to enable the firewall?" buttons {"Cancel", "Turn Firewall Off", "Turn Firewall On"} default button 1 with icon 2
set the userChoice to the button returned of the result
if the userChoice is "Turn Firewall Off" then
do shell script "defaults write /Library/Preferences/com.apple.alf globalstate -int 0" with administrator privileges
end if
if the userChoice is "Turn Firewall On" then
do shell script "defaults write /Library/Preferences/com.apple.alf globalstate -int 1" 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 "Application" type
- Type "run" in the Actions search box
- Double click "Run Shell Script"
- Click the
Run
button in upper right corner to test it. -
File > Save
to create the Application.
There is not an offline online mode in apple's own mail app as I know, only if you are not connected or you have a problem with auth, it shows as offline mode.
However, you can use LuLu, a 3rd party utility for this task to cut the connection of Apple Mail to WWW. I prefer this, open-source ftw.
https://objective-see.com/products/lulu.html
I hope this helps you focus :)
There seems to be confusion about online/offline -- but i assume you are talking about the options in the top "Mailbox" menu; "Take all accounts online", "Take all accounts offline", and "Online Status". i am on Catalina so maybe those options are not exactly the same for you, but i'm guessing it's something like that.
Anyway, the bad news is: it doesn't work. not the way you would expect. you can make an account offline but as soon as you try to access any of the imap content, it brings itself back online again without asking.
the only way i have found to avoid this without too much inconvenience -- don't get me wrong, this is still very inconvenient -- is to go to "Mail" > "Accounts..." (or "System Preferences" > "Internet Accounts") and select your account, and un-check "Mail". this will render the account disabled but you can bring it back without losing anything by re-checking "Mail" for that account when you are ready for it to be active again.
This is yet another disappointing Mail.app bug that will probably never be fixed because no one recognizes that it exists. but i hope this hacky work-around can help.
EDIT: after trying this again, now i can not see offline content for the disabled account. it was still able to view it when i tested this initially but now the account disappears when it is disabled. i'm thinking it was only working before because Mail was being buggy. i will keep trying stuff and i'll post back if i come up with anything else.