sisyphean.org

ceci n'est pas une blogue.

Listening to yesterday’s MacBreak Weekly, I couldn’t agree more with Merlin Mann’s comments on the “Only to Me” Outlook feature missing from Mail.app (and everything else).

Below is my little hack to make Mail filterable on this. I’m an architect, and the current construction management practice is to send one line notes from your Blackberry of whatever’s currently on your mind and forget it, assuming that that makes the problem “dealt with” along with the other 60 one-liners from today. People will tend to cluster-bomb everyone on the project with the note, except when it’s genuinely important, when they for some reason send it only to one person. That person is, of course, conditioned to think that there’s no need to forward information on anymore, except in this one case. A week later someone notices that the game of information tennis stopped with that recipient (who is more often than not me).

The script sort of works… stick it in ~/Library/Scripts/Applications/Mail and it will show up in Mail.app rules. I’ve got it setting the flag, marking it red and attaching a MailTags keyword. Suggestions welcome.

using terms from application "Mail"
  on perform mail action with messages theMessages for rule theRule
    tell app "Mail"
      set myAddresses to {"my_address@domain.com","my_other_address@domain.com"}
      repeat with eachMessage in theMessages
        set theFlag to true
        set theCCs to cc recipients of eachMessage
        if (length of theCCs) > 0 then
          set theFlag to false -- TODO: fix false positive when I'm BCC'd
        end if
        repeat with eachRecipient in recipients of eachMessage
          if address of eachRecipient is not in myAddresses then
            set theFlag to false
          end if
        end repeat
        -- TODO fix for when people To: me but CC: themselves, which gives a false negative
        if theFlag is true then
            -- the message was in fact only to me
            set background color of eachMessage to red
            set flagged status of eachMessage to true
          using terms from application "MailTagsScriptingSupport"
            set keywords of eachMessage to {"me"}
          end using terms from
        else
          set background color of eachMessage to none
          set flagged status of eachMessage to false
        end if
      end repeat
    end tell
  end perform mail action with messages
end using terms from

Sorry, comments are closed for this article.