2

In Mail app I work with many smart mailboxes and I and usually need to jump to the mailbox where the message is really filed.

It's the same with search results - I usually need to locate the folder (mailbox) where a message I selected in the result view is filed.

For previous versions of Apple Mail (at least up to Mavericks) I could do the same as I did in many other applications to locate the folder of the opened document in a window.

In the case of Mail.app:

  • Open the message (double-click)
  • Right-click the windows title bar where the subject of the message appear
  • You will see the path of that message
  • Select the desired folder

When I moved from Maverick to Sierra I sadly discovered that the previous approach did not work any more.

How can I fix this or achieve the same functionality?

  • I had the same question today. I'm using macOS 10.11 (El Capitan) and Mail 9.3, so thankfully your suggestion to use the right-click-the-title-bar did the trick. But, man, what a non-obvious approach for determining something so simple! I would have thought that an Inspector tool would have been built in to the app and/or the location path would be included in the message list. Do any of the post-Sierra macOS's work any better? – EJ Mak Jul 30 at 19:58
  • No, they make it worse. Since Sierra, I could not right-click the title bar anymore in Mail App. I could not find any other trick. I ended by creating the script, in the answer. – ePi272314 Jul 31 at 13:42
2

Solution using AppleScript

The solution I found was to create an Automator service and associate it to a shortcut.

  1. Open Automator
  2. New Document
  3. Select "Service" for the type of document
  4. At the top of the window, set the following options:
    Service receives selected >> no input
    in >> Mail.app
  5. In the Actions library (left pane) find the action "Run AppleScript"
  6. Drag and drop it in the workflow area
  7. Copy the code at the end of this answer and paste it into the action "Run AppleScript"
  8. Save your service (e.g. "Jump to Folder")

Test the service

  • No need to close automator or relaunch Mail.
  • Do a search and select a message (preferably a message filed in some custom folder).
  • Go to Mail >> Services. You should see your new service
  • Apply the service.

Your selected and active mailbox should be the mailbox of the previously selected message.

Optional

Assign a shortcut (e.g. CONTROL-COMMAND-J) to your service:

  • System Preferences >> Keyboard >> Shortcuts >> Services.
  • At the end of the right pane under General you should find your service.
  • Assign a shortcut to it.

The Code

set theDialogTitle to "Jump 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .