These are notes from my experiences converting from the slocal filtering system, which uses .maildelivery, to using procmail. I have dabbled in procmail for some automated mail handling, but always using another account. I found the pages in this wiki about sample procmail recipies to be a helpful refresher.
The first thing I did was convert my .maildelivery file to a .procmailrc file. I used the script at Converting .maildelivery rules to .procmailrc and updated it a bit - that page has my updates. My filters all used + to do rcvstore filtering, or qpipe (same as ^) to do custom filtering.
I use presort/slocal Incorporate style, with POP configured into my nmh configuration. So, I shut down exmh so it would stop filtering, and waited a bit to accumulate stuff in my spool. This was actually a slight mistake. I had tried to turn off background inc, but forgot to hit "Save" in preferences, so the background process was still watching my MyIncTmp folder. So, I quit instead, but then found myself wanting to restart exmh later, but with new preferences. Not a big deal, but probably the best thing would have been to turn off all the automatic inc'ing (in the background, on startup, etc.) and then quit.
I pulled it into the MyIncTmp directory as a staging area:
inc +MyIncTmp -host mailserver.company.com
Oh goodie, there is at least one SPAM in there so I can test my spamassassin installation as well. To test my filters I first changed
VERBOSE=on
in the .procmailrc file. Then I ran procmail as:
procmail ~/.procmailrc < ~/Mail/MyIncTmp/2
The results of procmail are put into its LOGFILE, so you need to check that to see what happened. The conversion script creates a .procmailrc that sets LOGFILE to ~/Mail/procmail.log.
Perfect! spamassassin configured itself and hit on that message about "Fast & easy way to get your medication today" just like I hoped.
Now, I'm ready to restart exmh and see how it goes. Now, I didn't have the forsight to change my preferences before I quit exmh. So, I'll edit my ~/.exmh/exmh-defaults file and change the inc filter used for "presort" from slocal to procmail
*incfilter: procmail
This seems to have worked like a champ.
One glitch: my qpipe commands referenced programs in my ~/bin directory as "bin/mumble" but I needed to change those to "$HOME/bin/mumble" in my ~/.procmailrc file.
One final step. If you log your procmail deliveries, you want to rotate that log. The mailstat program is designed for this. I added this to my crontab:
0 1 * * 1 mailstat $HOME/Mail/procmail.log | mail welch -s "procmail stats (personal)"