Posted By

berkes on 12/02/09


Tagged

mail backup archive ubuntu imap cron archivemail evolution


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

berkes


Run Archivemail on all your IMAP folders.


 / Published in: Bash
 

URL: http://www.linux.com/archive/feature/151688

Change 'username' (twice!) with your imap username,'password'with your imap password, and 'example.com' (twice!) with the url of your imap mailserver.

Works on: Ubuntu with Evolution, sqlite3 and archivemail installed. Evolution is required because evolution stores the available folders in IMAP. sqlite3 is requird to extract those available folders and recurse trough them.

This command looks up all the available folders in your imap box, recurses trough them and runs archivemail to archive all the online mail.

NOTE: remove the -n (dy-run) flag to actually archive the items. NOTE: remove the -v (verbose) flag to be less verbose.

TODO: option to purge empty directories. TODO: store username, password and mailserverURL in a $VAR.

  1. for folder in `sqlite3 .evolution/mail/imap/username@example.com/folders.db "SELECT folder_name FROM folders"`; do
  2. archivemail -d 60 -S 1048576 -u -v -n "imaps://username:[email protected]/$folder";
  3. done

Report this snippet  

You need to login to post a comment.