Blog Posts

My Inbox Archiving Apple Script for Apple Mail

Like many other power users I am using a simple approach to email: Inbox Zero. The goal is to clean up your email inbox at the end of the day. Emails you've already processed are moved to an Archive folder. I've seen a lot of Apple Scripts in the wild to move emails to a local Archive folder or all emails to IMAP Archive folders for every account. But I did not came across a script that only moves selected emails to IMAP Archive folders. Hence being a nerd, I wrote my own:

tell application "Mail"
  set _sel to the selection

  repeat with _message in _sel
    set _mb to mailbox of _message
    set _acct to account of _mb

      set _archive_box to _acct's mailbox "Archive"
    on error
      display alert "No “Archive” mailbox found for account “" & ¬
        _acct_name & "”."
    end try

    move _message to _archive_box
  end repeat

end tell

The script above iterates over every selected email message, searches for an 'Archive' folder in the respective account and moves it to this folder. I am using FastScripts by Red Sweater Software to invoke the script using cmd+shift+A.

This work is derived from the 'Simple Inbox Archiving Script for Apple Mail' by John Gruber of Daring Fireball.

July 13th, 2011 • Permalink

More articles about Blog Posts

05/23/2015 - Instacast 5.1 adds Apple WATCH support
04/01/2015 - Snowflake Lite on the Mac App Store
03/02/2015 - Announcing Snowflake 1.0
12/10/2014 - Instacast for Mac 2.0 Now Available
10/31/2014 - Up Next in Instacast 5
10/22/2014 - Instacast 5 available today
09/16/2014 - Updates on Instacast 5
06/27/2014 - Instacast Cloud Memberships
06/06/2014 - Instacast 4.6 and Instacast Cloud
03/26/2014 - Sharebox adds Drag & Drop sharing to the Dropbox menubar icon
01/22/2014 - Instacast 4.2 adds News Mode