Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

An AppleScript to move or delete old Mail messages Apps
This AppleScript will move or delete messages that are over a certain number of days old in Mail. By default, it will move messages that are 160 days or older to a mailbox called Archive and display a dialog box for each mailbox it is processing. You can change any of this by adjusting the parameters at the top of the script.

I really wanted to display a progress bar, but I couldn't find an easy way to do it without requiring a plug-in.

[robg adds: To use this script, paste the text into Script Editor, then save it to your user's Library -> Scripts -> Mail folder. I haven't tested this one (my Mail is already sorted into numerous folders based on content), so I'm not sure if it's 10.4 only or not. Note that the script will move messages by default; if you'd like to just delete old mail instead, remove the DestinFolderName entry on the second line (i.e. set DestinFolderName to "").]
    •    
  • Currently 4.00 / 5
  You rated: 5 / 5 (5 votes cast)
 
[12,722 views]  

An AppleScript to move or delete old Mail messages | 5 comments | Create New Account
Click here to return to the 'An AppleScript to move or delete old Mail messages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
What is it with Mail?
Authored by: designbot on Jul 29, '05 12:56:25PM

Yay! Another roundabout AppleScript hint for a simple Mail feature!

Why not make a rule whose criterion is "Date Received is more than 160 days old"? Oh, right, that would be obvious and simple.



[ Reply to This | # ]
What is it with Mail?
Authored by: rossr on Jul 30, '05 02:28:26AM

Such sarcasm! ;)



[ Reply to This | # ]
What is it with Mail?
Authored by: voegelas on Jul 30, '05 03:34:07AM

I do also use an AppleScript to delete old messages since I couldn't figure out how to apply a rule to a certain set of mailboxes only. I'd like to use different expiration times for different mailboxes. How can you do this with rules?



[ Reply to This | # ]
What is it with Mail?
Authored by: fresler on Jul 31, '05 08:31:46AM

I, too, tried to figure a way to do this with rules before writing the script. I tried the rule you suggested and nothing happened. So, if you know a way to make this work on all mailboxes in all accounts like my script, please pass it along. It may be something simple I'm missing in setting up rules, but I can't figure it out.



[ Reply to This | # ]
What is it with Mail?
Authored by: walueg on Aug 03, '05 04:52:36PM

Mail rules do NOT move actual mail files. It merely makes pointers to the real ones that lie on the server(s). You need a script like this to make it work.

Thanks! I needed this!



[ Reply to This | # ]