Procmail is still widely used although it is no longer maintained. Its former maintainer on OpenBSD, Philip Gunther, has said that it should be removed from the ports list because of security vulnerability, although it is still there. A suggested alternative is fdm, which both fetches the mail from a POP3 server and filters it, thus cutting out the need for fetchmail.
I’d been using procmail with fetchmail for a long time but I thought perhaps I should switch to fdm. The main difficulty was that the documentation I found was less complete than what is available for procmail. Getting my mail filtering program to work was a particular problem.
I thought it might be worth posting my fdm.conf here for anyone who is thinking of making the same switch. I use qsf as my spam filter but it should be easy to adapt the script to work with a different filter. Qsf writes “SPAM” in the subject line of suspect emails so that’s what I filter on. I’ve posted more details about qsf in a separate entry.
# fdm.conf – see the fdm manual for explanations of the code.
# Set the maximum size of mail:
set maximum-size 128M
# connection settings for my ISP’s mail server:
account “<my POP3 account>”
pop3 server “<my POP3 server>”
user “<my email address>”
pass “<my password>”
# filtering rules (adapted from my .procmailrc:
match “^(To|Cc):.*email@example.com” action mbox “%h/Mail/lyx-users”
match “^(To|cc|Cc|Sender): .*firstname.lastname@example.org” action mbox “%h/Mail/openbsd”
match “^Subject:.*Sucuri Alert” action mbox “%h/Mail/sucuri” action pipe “cat > /dev/null”
# forward some mail to a different account (see “My foreward file” below):
match “^From:.*Facebook” action pipe “%h/.forward”
# Spam filter rules:
action “spamfilter” rewrite “/home/ac/bin/qsf -s”
match all action “spamfilter” continue
match “^Subject:.*SPAM” action mbox “%h/Mail/spam”
# Set spoolfile for incoming mail:
action “inbox” mbox “/var/mail/ac”
match all action “inbox”
My .forward file