Backup Your Mailbox With Gmail (from a low memory machine )
A great tool to backup your mailbox (accessible via IMAP), is imapsync.
However, imapsync keeps eating your RAM until it has finished its job…if you have little memory, it will fail almost everytime…
The simplest solution is to run it for each of your subfolders, if you sorted your (huge) e-mail account accordingly. just crate a simple shell script like this one:
#!/bin/sh
IMAPSYNCOPTS='--ssl1 --host1 my_mail_server --user1 my_email_user --passfile1 /etc/secret1 --authmech1 LOGIN --ssl2 --host2 imap.gmail.com --user2 my_gmail_user --passfile2 /etc/secret2 --authmech2 LOGIN --syncinternaldates --delete2'
/usr/local/bin/imapsync ${IMAPSYNCOPTS} --folder 'INBOX'
for folder in `cd /home/vpopmail/domains/my_domain/my_email_user/Maildir/ ; ls -1d .* | tail +3`
do
/usr/local/bin/imapsync ${IMAPSYNCOPTS} --folder INBOX$folder
done
Replace mymailserver, myemailuser, mygmailuser, my_domain by the appropriate values, and fill /etc/secret1 and /etc/secret2 with the respective passwords. Of course, for this to work, you have to have shell access to your local IMAP server (the one to backup).