How tag emails in Apple Mail

emailfinder-tagmail.app

My goal?
To tag emails in OS X.

What I succeeded into?
I use the Find command in /Users/MyMacAccount/Library/Mail/V3/ with a significative word contained in the email I am looking for, then I tag the email.

Note:
After this I can easily find all tagged emails with the find command in Apple Mail. I think this tip could please a lot of users.

How could it be done better?
To right click on the email and directly locate it in the Finder.

Note:
In past OS X (I am under 10.11.x El Capitan) it was possible to locate an email by command clicking on his title bar. A menu appeared with the actual path on the hard drive. It seems Apple disabled this so we can only see account's name.

What could I do instead?
To use the colored flags in Apple Mail… Frankly, who remembers why he or she colored one email in orange or purple ?

In the past, there was MailTags paid plugin, but it seem it wasn't updated for a long time.

I thought I could easily almost find recent emails if I sorted the V3 folder by Date but this is a slow process to be accomplished by the Finder.

Any better idea ?
Thank you.

Best Answer

This is work around, but it works for me, and it travels through all MacOS versions from I guess Mountain Lion (not sure when, made it long time ago). Not sure if it is still relevant, but since I found question without answer in search for the same, decided to contribute. Here what I did: with automator create new service for Mail app, "Get Selected mail message". In code I have put:

on run {input, parameters}
  set theSource to {}
  tell application "Mail"
    repeat with msg in input
      set t_myFolder to POSIX path of (account directory of account of mailbox of msg as rich text)
      set len to length of t_myFolder
      set myFolder to rich text 1 thru (len - 1) of t_myFolder
      set messageId to (get id of msg as rich text)
      set myfile to (do shell script "find " & quoted form of myFolder & " -name \"" & messageId & "*.emlx\"") as rich text
      try
        set myalias to (POSIX file myfile) as alias
        if myalias is not missing value then
          tell application "Finder"
            activate
            reveal myalias
          end tell
        end if
      on error
        set debugInfo to "messageID: " & messageId & "
        myFolder: " & myFolder & "
" & "myFile: " & myfile
        display alert "Error ocured. Some Debug info bellow:
        " & debugInfo
        return
      end try
    end repeat
  end tell
end run

What it does - is finds mail message file in Finder and selects it. Then you can add tags to that particular file. After only thing remains is to assign a shortcut in the services (under keyboard).

Choose Service receives selected, "files or folders" in "Mail.app" when creating your Automator Service.

Regards Justas