3.x in Leopard - Rule to Tag Mail as "Expiring" Takes Advantage of Address Book Groups

As a New Year’s project, besides biking a lot up and down along the Sakai River on my new Centurion, I decided to try switching from Entourage 2004 and its monolithic mail store file, to the that comes with OS/X Leopard and use Gmail IMAP. Here’s what I did:

One thing I have set up in Entourage is a rule that runs an AppleScript to search a long list of sender email addresses from which comes mail I want to mark as “Expiring”. These are newsletters, RSS newsfeed updates and other information that I don’t necessarily want to keep, but want an easy way to find for later deletion.’s rules work fine, but, once you get past 10 or 15 criteria lines inside a given rule, you cannot add more because the panel being used does not scroll as you can see here. I was going to rewrite my original Entourage script that I was triggering for every message:

tell application “Microsoft Entourage”
    set theMsg to item 1 of (get current messages)
    set theAddress to the sender of theMsg
    set theAddressString to the address of theAddress
    set theName to the display name of theAddress
    set theSubject to the subject of theMsg
    set theTargetCategory to category “Expiring”
    –List of mail addresses to check
    set fromList to {“”, “”, “”}
    if fromList contains theAddressString then
        set category of theMsg to theTargetCategory
    end if
end tell

… and try to use this method for all mail that comes in and is processed by However, it occurred to me that I could simply add all senders to my address book, put the ones I want to mark as Expiring in an Address Book group, then run a rule to check that.

Turns out that Address Book is indeed well integrated and there are rules you can use. In addition, to have the ability in to “tag” messages like you can do already in Entourage 2004 via its Categories, the excellent MailTags comes to the rescue, so that you can keyword each message you are marking.

Here are the steps:
- In Address Book, add a group, say, “Expiring”. - In MailTags preferences in Mail Preferences, add the keyword “Expiring”. - In, open Mail preferences and open the Rules pane. Add a new rule and give it a name like Expires. - If “Any” of the conditions is met, choose “Sender is a Member of Group” and the group name “Expiring”. - Perform the following actions: choose “Set color of message” “of background” or “of text” and a color to indicate that the message is Expiring. - Next action: “Set mailtags keyword” then “Add” then “Expiring”. - Next action: “Stop Evaluating Rules” if appropriate. - Save and test.

Because you have the keyword “Expiring” now in the headers of messages that trigger this rule, you can use a smart folder in to view all expiring messages and make a human decision on what action to take - delete or archive.


Join the discussion at my Google+ post.

—by Rick Cogley