1

I have a number of rules in Mail.app (these ones work!) to move e-mails which are X days old to trash.

I'd like to run these rules at a specified time, eg: midnight. In this case, the particular rules will move e-mails which are older than 1 day to trash.

I use Mail Act-On and Mail Tags, but cannot find any functions there.

Is it possible with Mail.app natively? If not, is it possible with some plugin? Ideally open-source.

1

Here is how I would approach this - note it is quite technical and is recommended only to people who know what they are doing.

1) Write an Apple Script to send the keystroke to apply your defined rules in Mail.app

2) Schedule a crontab to run that script at predetermined times

To start you off here is a sample script that I have written:

tell application "System Events"
tell application "Mail" to activate
keystroke "l" using {command down, option down}
end tell

Then to schedule your job (e.g. midnight) by adding a crontab entry - change the username to the user you are running Mail.app as - leave osascript as it is

* 0 * * * username osascript 'path to your script.scpt'

Alternatively use a GUI to schedule the above such as cronnix http://code.google.com/p/cronnix/

4
  • Hi, I like the approach. I hadn't thought about using applescript... "keystroke "l" using {command down, option down}" I guess this line is for the keystroke set-up in Mail Act-On to activate the particular defined rule? If so, I follow. I'll try it later on and let you know. Jan 13 '12 at 9:11
  • Unfortunately I am not aware of running individual rules, the above shortcut will apply all rules that you have defined (as it is an existing Mail.app shortcut)
    – osx86x
    Jan 13 '12 at 9:44
  • Juat to clarify: "keystroke "l" using {command down, option down}" This 'l' is an existing Mail.app shortcut to apply ALL rules? thanks. Jan 13 '12 at 10:09
  • Yes as in Option+Command+L
    – osx86x
    Jan 13 '12 at 10:12

You must log in to answer this question.

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