I setup fetchmail to grab the email from all my different POP3 email accounts, run it through procmail/spamassassin locally to filter out evil spam and then deliver it to $HOME/Maildir. Courier is then used to serve up the Maildir via IMAP to the machines on my local home network.
This way, i can connect to the local IMAP server from any of the machines on my local network and see the same exact view of my email.
Install Courier-IMAP: apt-get install courier-imap courier-imap-ssl
Courier was pretty easy to get running,
there was little or no configuration to be done.
Install exim: apt-get install exim
I selected "(1) Chose this if none of the other options exactly fit
your needs" from the config menu and configured exim.conf by hand (see below).
local_delivery:
driver = appendfile
group = mail
mode = 0660
mode_fail_narrower = false
envelope_to_add = true
return_path_add = true
directory=${home}/Maildir
maildir_format = true
prefix = ""
address_directory:
driver = appendfile
no_from_hack
prefix = ""
suffix = ""
maildir_format
[...]
userforward:
driver = forwardfile
file_transport = address_file
pipe_transport = address_pipe
reply_transport = address_reply
directory_transport = address_directory
no_verify
check_ancestor
check_local_user
file = .forward
modemask = 002
filter
If you choose Option 2, your ~/.forward file should contain just a path to your maildir (i.e. /home/username/Maildir/)
# mail -s "test message" username[ENTER]
test[ENTER]
^D
Cc:[ENTER]
^D is Control-D, not the individual "^" and "D" characters
Configuring /etc/login.defs - for console applications
QMAIL_DIR Maildir/
#MAIL_DIR (comment this out)
MAIL_FILE Maildir/
Log into IMAP - If everything is configured, you should see something
like this
scott@tomb [~]$ telnet snark imap2 Connected to snark. Escape character is '^]'. * OK Courier-IMAP ready. Copyright 1998-2002 Double Precision, Inc. ab login "username" "password" ab OK LOGIN Ok. bc select "Inbox" * FLAGS (\Draft \Answered \Flagged \Deleted \Seen \Recent) * OK [PERMANENTFLAGS (\Draft \Answered \Flagged \Deleted \Seen)] Limited * 0 EXISTS * 0 RECENT * OK [UIDVALIDITY 1056081360] Ok bc OK [READ-WRITE] Ok zzzz logout * BYE Courier-IMAP server shutting down zzzz OK LOGOUT completed Connection closed by foreign host. scott@tomb [~]$
poll hurring.com proto pop3 user
"user@hurring.com" password "password",
is "scott" here
mda "/usr/bin/procmail";
This stanza tells fetchmail to go and get my emails from hurring.com and then
pass them along to procmail as local user "scott" which means
it will read /home/scott/.procmailrc
and deliver the mail into /home/scott/Maildir.
To test, run: fetchmail -kv
The -k option tells fetchmail
to not delete any email from your POP3 mailbox, and the -v option gives verbosity.
I took the example .procmailrc from the spamassassin website and added some additional rules to filter my mail into different folders depending on some simple rules.
This is my .procmailrc