Install getmail (aptitude install getmail4) Set Up Your Imap Server (tl;dr) getmail ruby date_based_archive.rb ~/Maildir/.Archive