Rule to move old mailing list messages

  • Thread starter Jeffrey Frankel
  • Start date
J

Jeffrey Frankel

My wife in on the New York Times daily mailing list. She frequently falls
behind in reading the dailies. I blithely suggested, "Well, it shouldn't be
any problem for me to create an Entourage rule that will leave the most
recent Times in your inbox and move all the older ones to a separate 'Old
NYT' folder in your folder list." I was able to write the rule, and can
execute it manually by selecting all messages in the inbox and then
selecting Apply Rule from the Entourage Message menu. However, I was hoping
to have the rule run automatically - once per day, for example, or maybe
upon arrival of the daily mailing list message from the Times. But I can't
seem to do this from the rules dialog box. Entourage Schedules don't
directly run rules, either. But both rules and schedules can execute
Applescripts, and perhaps that's the key. The Entourage Applescript library
does show a rules property for the mailing list object, with the following
notation: " If true, apply rules to messages from the mailing list." Can
anybody provide any insight/help on this project? Many thanks.

Jeff Frankel
 
B

Barry Wainwright [MVP]

My wife in on the New York Times daily mailing list. She frequently falls
behind in reading the dailies. I blithely suggested, "Well, it shouldn't be
any problem for me to create an Entourage rule that will leave the most
recent Times in your inbox and move all the older ones to a separate 'Old
NYT' folder in your folder list." I was able to write the rule, and can
execute it manually by selecting all messages in the inbox and then
selecting Apply Rule from the Entourage Message menu. However, I was hoping
to have the rule run automatically - once per day, for example, or maybe
upon arrival of the daily mailing list message from the Times. But I can't
seem to do this from the rules dialog box. Entourage Schedules don't
directly run rules, either. But both rules and schedules can execute
Applescripts, and perhaps that's the key. The Entourage Applescript library
does show a rules property for the mailing list object, with the following
notation: " If true, apply rules to messages from the mailing list." Can
anybody provide any insight/help on this project? Many thanks.

Jeff Frankel

Applescript is the right way to go about it - these can be run by schedules.
However, the entry you saw in the dictionary is a property of a mailing list
entry (and is directly equivalent to the 'allow rules to act on list
messages' check box).

What you need your script to do is select messages from nytimes.com (or
whatever domain the messages come from) that are older than 7 days, and move
them to a new folder.

Fortunately, scripting in Entourage is both powerful and flexible, and this
action can be completed in a single line of script:
tell application "Microsoft Entourage" to move (every message of folder id 1
where address of sender contains "nytimes.com" and time sent < (get (current
date) - 7 * days)) to folder "Old NYT"

Note that you need to change the ³nytimes.com² to whatever the domain is in
the massages, and that if the folder ³old nyt² is a subfolder of some parent
folder (called, for the sake of example, ³parent²) you need to change the
end of the line to:
...to folder ³Old NYT² of folder ³Parent²
Save the script somewhere convenient (as a compiled script, not an
application) and set up a schedule to run the script once a day or whatever
you find convenient.
 
J

Jeffrey Frankel

Barry, thank you so much. The script you wrote for me was spot-on and
accomplishes exactly what I was trying to do.

Jeff Frankel
 
Top