In the Mail app of macOS, I work with lots of smart folders (a particular mailbox that shows the results of pre-defined search criteria). Thus, these smart mailboxes show messages from different accounts and folders.
Usually, I need to jump to the actual mailbox/folder where is located a message selected in the list of results. I also have many folder.
One of the improvements (annoyances) in the new Mail app was that I could not find a way to do that. In past versions of macOS (at least up to Mavericks) this was easy. I could do the same as I still do in many other applications. See the image.
The previous trick is not working anymore in the message windows of the Mail App.
Is there any way to jump or open the mailbox/folder where is located a message I select in a search result or smart mailbox?
The solution I found was to create an Automator Service and optionally associate it with a shortcut.
Service
for the type of document.Service receives selected
choose no input
in
choose Mail.app
Run AppleScript
.Run AppleScript
.When testing the service, Automator could remain open and also the Mail App.
Mail
> Services
. You should see your new service.The selected and active mailbox/folder should be the mailbox of the previously selected message.
Keyboard
> Shortcuts
Services
General
you should find your serviceset theDialogTitle to "Go to Folder Script"
tell application "Mail"
-- Get the selected messages and the count of them
set theMessageList to selected messages of message viewer 1
set theCount to length of theMessageList
-- Error if no messages
if theCount is 0 then
display dialog ¬
"No message selected." with title theDialogTitle buttons {"OK"} with icon caution
return
end if
-- Error if more than one message
if theCount is greater than 1 then
display dialog ¬
"Must select only one message." with title theDialogTitle buttons {"OK"} with icon caution
return
end if
-- Get the message
set theMessage to item 1 of theMessageList
-- Get the mailbox object
set theMailbox to mailbox of theMessage
-- Select the mailbox
set selected mailboxes of message viewer 1 to theMailbox
end tell