Mon 25 Sep 2006
Using fetchmail and procmail for maildir style storage from a pop3 account
Posted by carson under linux , system administration , utilitiesFor the longest time having POP3 messages stored in one large file bothered me. I found out however that you can easily convert the single file storage into Maildir style storage with fetchmail and procmail. Here are the steps I used to fetch mail from a POP3 mailbox and store the messages in Maildir style folders.
1. Fetchmail setup
The following configuration file for fetchmail will pop all the mail off the server and purge it so be careful. The main thing to notice is the mta line at the end that calls procmail.
set invisible
set no bouncemail
poll "mail.mypop3service.com"
protocol pop3
username "username"
password "password"
fetchall
nokeep
mda "/usr/bin/procmail -m /directory/to/procmail.conf"
2. Procmail setup
This is a very simple Procmail configuration file. It stores everything in on directory called Mail. The main thing to notice here is that there is a / at the end of the directory.
MAILDIR=$CORRECTHOME/
PMDIR=/directory/to/store/procmail/info/in
LOGFILE=$PMDIR/log
VERBOSE=on
:0
Mail/
3. Running fetchmail
Now all you need to do is run fetchmail with the above configuration file:
Doing this should result in a number of files stored in your Mail/cur directory if there are messages on the server.


















November 22nd, 2006 at 2:34 pm
Good job. It is working fine. I just tested it. I tried to access to the gmail. I had to add "ssl" to the fetchmail configuration file to enable SSL. That is all. Thank you
January 27th, 2007 at 8:28 am
Great Tutorial. I had been meaning to do this for a while.
My next step is to configure squirrelmail to present a web based interface to the imap server.
Thank you for getting me started