I had some trouble setting up Apple Mail the way I want it to work. What I’m used to doing is keeping a list of “Unread” messages, which is really a list of “Messages that need some action from me before I can forget about the message”.
By default, Apple Mail doesn’t really work well with that. I did manage to configure it the way I wanted after a couple of hours of work.
First of all, I needed to create a Smart Mailbox with a filter that only shows unread messages. This was easy enough.
The first real problem was the way Mail marks messages read. By default, just selecting a message automatically marks the message read. I don’t want that. I want to manually mark the message “read” when I’m done with it. Unfortunately there seems to be no way to do that with a regular installation of Mail.
A free add-on called TruePreview fixes this. It adds a new preference panel to Mail that allows you to disable the feature that automatically marks messages read.
The next problem is that Smart Mailboxes don’t get updated automatically. After you mark a message read, the message stays in the Smart Mailbox until you leave the Smart Mailbox and come back, or you select “Rebuild” from the “Mailbox” menu.
For this, I first wrote a short AppleScript:
Note: See update below!
Another note: See the new update below the first one!
A third note on 2014-02-14: What was I thinking? All that really needs to be done is move down and up to go to any other mailbox…
tell application "Mail" to activate tell application "System Events" to tell menu bar 1 of process "Mail" tell menu bar item "Message" tell menu "Message" tell menu item "Mark" tell menu "Mark" click menu item 1 end tell end tell end tell end tell click menu item "Rebuild" of menu "Mailbox" of menu bar item "Mailbox" end tell
Basically the script does two things: Mark the message read, and rebuild the mailbox.
The last thing I needed was a way to activate the script easily. I downloaded a program called FastScripts, which allows you to define keyboard shortcuts for AppleScripts. I defined Mail’s default shortcut (Cmd-Shift-u) for marking messages read to running the script instead.
The end result: When I’m browsing my “Unread” Smart Mailbox, I just need to press Cmd-Shift-u, and the message is marked read, and the Smart Mailbox rebuilt, so the message immediately disappears from the list.
The last small annoyance with this is that after marking the message read, no message is selected in the “Unread” mailbox, so you need to manually select the next message to work with. This could probably be fixed with more AppleScript, but I didn’t have time to do that just yet.
UPDATE 2013-06-20: So, I pressed my fancy new keyboard shortcut once too often in the main Inbox view, forcing a full rebuild of every single message I have there. That’s especially painful on a slow Internet connection. Here’s the improved version of the script, with additions copied from this post.
tell application "Mail" to activate tell application "Mail" try set currentMailboxes to (selected mailboxes of message viewer 1) -- that's all we care about. If the above line works, we have a regular mailbox selected display dialog "Regular mailbox - please don't rebuild!" on error tell application "System Events" to tell menu bar 1 of process "Mail" tell menu bar item "Message" tell menu "Message" tell menu item "Mark" tell menu "Mark" click menu item 1 end tell end tell end tell end tell click menu item "Rebuild" of menu "Mailbox" of menu bar item "Mailbox" end tell end try end tell
UPDATE 2013-06-26: I’m still getting accidental rebuilds of all of my Inbox for some reason. I took a completely different approach to this, forcing the “rebuild” of my smart mailbox by briefly going over to my main Inbox. GUI scripting at it’s finest…
tell application "Mail" activate # Mark the message read, as the shortcut should tell application "System Events" to tell menu bar 1 of process "Mail" tell menu bar item "Message" tell menu "Message" tell menu item "Mark" tell menu "Mark" click menu item 1 end tell end tell end tell end tell end tell # Pop over to Inbox for a bit to force a rebuild of Unread set selected mailboxes of message viewer 1 to {inbox} tell application "System Events" to tell process "Mail" --Let's move the focus from the messages to the Mailbox list by simulating a Shift-Tab press - a few times. key code 48 using shift down key code 48 using shift down key code 48 using shift down key code 48 using shift down key code 48 using shift down --Arrow up 126 here to get to the Smart Mailbox, use 125 if you need to move down key code 125 key code 125 key code 125 --And let's move the focus back to the message list on the right key code 48 key code 48 key code 48 key code 48 key code 48 end tell end tell
UPDATE 2014-02-14: A simplified version:
tell application "Mail" activate # Mark the message read, as the shortcut should tell application "System Events" to tell menu bar 1 of process "Mail" tell menu bar item "Message" tell menu "Message" tell menu item "Mark" tell menu "Mark" click menu item 1 end tell end tell end tell end tell end tell tell application "System Events" to tell process "Mail" --Let's move the focus from the messages to the Mailbox list by simulating a Shift-Tab press - a few times. key code 48 using shift down key code 48 using shift down key code 48 using shift down key code 48 using shift down key code 48 using shift down --Move down and up just to go to some other mailbox, forcing a refresh. key code 125 key code 126 --And let's move the focus back to the message list on the right key code 48 key code 48 key code 48 key code 48 key code 48 key code 48 end tell end tell
Finally, I found an email client that:
– Works with corporate Exchange accounts
– Does not such horribly
Still in beta, but in the last few builds I’ve decided that it’s good enough to be my primary work email client: http://airmailapp.com/
Check it out.