MailArchiveByDate

Sort Mail.app Messages into Archive Folders

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.

Using with MailActOn

  1. Save MailArchiveByDate.scpt and ArchiveMessages.scpt to ~/Library/Scripts/Mail\ Scripts.
  2. In Mail.app, create a new top-level mail folder called "Archive".
  3. Set up a MailActOn rule to run your new script:
       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.

Using with iCal Trigger

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.

  1. Save MailArchiveByDate.scpt, ArchiveOldMessageFromInbox.scpt, and AutoArchive.scpt to ~/Library/Scripts/Mail\ Scripts.
  2. Edit AutoArchive.scpt to set the DAYS_TO_SAVE, ARCHIVE_FOLDER and ACCOUNT_NAMES properties.
  3. Schedule a recurring event in iCal to run AutoArchive.scpt (set the alarm to "Run Script" and browse to select AutoArchive.scpt).

To schedule accounts with different DAYS_TO_SAVE, create a copies of AutoArchive.scpt.

Version 1.5

Released: Sun Apr 15 12:12:13 2007
Release Details

Download

Download version 1.5

Related Links