Table of Contents

Download mail

Using imapgrab.py script that is a wrapper for getmail

Command to list all mail from server

./imapgrab.py -l -s somemailserver.com -u someuser@example.com -p <password>

Command to download all mail from server (maildir)

This one uses the maildir format (one file per email, one directory per imap folder)

cd /home/someuser1/imap_files/imapgrab
mkdir mdir
nohup ./imapgrab.py -d -M -a -f /home/someuser1/imap_files/imapgrab/mdir -m "_ALL_" 
-s somemailserver.com -u someuser@example.com -p <enterpass> > imapgrab.log 2>&1

Output

someuser1@ub1:~/imap_files/imapgrab$ cat imapgrab.log
nohup: ignoring input
IMAP Grab 0.1.4
---
Downloading mailbox "INBOX"
Downloading mailbox "INBOX.Drafts"
Downloading mailbox "INBOX.Sent"
Downloading mailbox "INBOX.Trash"
....
....
Downloads complete

Command to download all mail from server (mbox)

This one uses the maildir format (one file per imap folder)

cd /home/someuser1/imap_files/imapgrab
mkdir mdir1
nohup ./imapgrab.py -d -B -a -f /home/someuser1/imap_files/imapgrab/mdir1 -m "_ALL_" 
-s mail.lonex.com -u someuser@example.com -p lotus111 > imapgrab1.log 2>&1 &

Output

someuser1@ub1:~/imap_files/imapgrab$ cat imapgrab1.log
nohup: ignoring input
IMAP Grab 0.1.4
---
Downloading mailbox "INBOX"
Downloading mailbox "INBOX.Drafts"
Downloading mailbox "INBOX.Sent"
Downloading mailbox "INBOX.Trash"
....
....
Downloads complete