MailArchiveByDate is an AppleScript to organize archived email into separate mailboxes. It can be used with Mail.app under OS X to group messages based on the date sent so archive mailboxes are broken up into manageable chunks.
Each time it processes a message, it automatically maintains a folder hierarchy based on the parent, year, and month:
* parentMailboxName
o 2006
+ 01
+ 02
+ ...
MailArchiveByDate is most suitable when used as a library for another script which can be run via a MailActOn action to file selected messages. The reason for having a separate script is so you can separate personal messages from work messages in the archive.
Description: Act-On: s | Archive Messages Condition: Every Message Run AppleScript: ~/Library/Scripts/Mail\ Scripts/ArchiveMessages.scpt
Now when you select one or more messages and press Ctrl-S, they will be archived to the appropriate sub-folder of your "Archive" mailbox.
For archiving to an IMAP server, edit the ArchiveMessages.scpt script using Script Editor. Set the IMAP_ACCOUNT property to the name of the IMAP account as it appears in the list of accounts.
In addition to manually archiving messages using MailActOn, it is also possible to schedule an iCal event to archive "old" messages on a regular basis.
To schedule accounts with different DAYS_TO_SAVE, create a copies of AutoArchive.scpt.