Fdm

fdm stands for fetch and deliver mail. It fetches mail from a POP3 or IMAP server to your computer so you can read it locally using a mail client like bsd mail.

In ~/.fdm.conf:

set no-received # don't insert a ‘Received’ header into each mail
set verify-certificates # verify SSL certificates
# Catch-all action (mbox):
action "inbox" mbox "/var/mail/%25u" # download mail in mbox format to /var/mail/user123
# Catch-all action (maildir):
#action "inbox" maildir "%25h/Mail/INBOX" # download mail in maildir format to ~/Mail/INBOX, but commented out
account "user123" imaps server "imap.ircnow.org"
 user "user123@ircnow.org" pass "pass123" new-only keep
# Match all mail and deliver using the 'inbox' action.
match all action "inbox"

Replace user123 and pass123 with your real username and password.

For extra user accounts, simply add another two lines:

account "user123" imaps server "imap.ircnow.org"
 user "user123@ircnow.org" pass "pass123" new-only keep

Make sure you have the keep keyword, or else fdm will request the IMAP server to delete your mail. new-only tells fdm only to download new mail (and not all mail).

To fetch mail, simply run:

$ fdm -v fetch