Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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/

share|improve this answer
    
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. –  Bernard Tyers 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. –  Bernard Tyers Jan 13 '12 at 10:09
    
Yes as in Option+Command+L –  osx86x Jan 13 '12 at 10:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.