Getting bogofilter to work with procmail, fetchmail, and muttby Richard HollosLast modified: When I needed it, I didn't find any quick and dirty instructions for getting bogofilter to work with procmail, fetchmail, and mutt, so I'm posting this so that others may have an easier time of it. At Exstrom Labs we had been using mutt and fetchmail for a long time, and were getting tired of dealing with spam manually and wanted to find a good spam filter. We narrowed it down to SpamAssassin or bogofilter. Reading about both, my impression was that SpamAssassin was easier to get going, but that bogofilter was faster. In my view, speed beats ease of installation, so I decided on bogofilter.
Our server computer had the following:
Went into ~/Mail which is where all the mailboxes are,
and typed:
In the ~/Mail directory, temporarily moved the spam folder to ~ then typed: Moved the spam folder back to ~/Mail then renamed it spam-old, and created a new mail folder with nothing in it, called spam. This is where procmail will automatically place spam as identified by bogofilter. I also created an empty mail folder called unsure which is where procmail will put all emails that bogofilter is unsure of. Created file ~/.procmailrc which contains: MAILDIR=~/Mail LOGFILE=$MAILDIR/procmail.log #Send mail thru bogofilter :0fw | /usr/bin/bogofilter -uep #Put mail bogofilter deems as spam in spam folder :0: * ^X-Bogosity: Spam, tests=bogofilter spam #Put mail bogofilter deems as unsure in unsure folder :0: * ^X-Bogosity: Unsure, tests=bogofilter unsure
Fetchmail must now be called like this:
Created an alias for this fetchmail command by putting the following line in
/etc/profile.local Improving bogofilter performance can be done as follows.
For spam that gets into your inbox, enter the following in mutt:
For ham wrongly placed in the spam folder, enter the following in mutt:
To automatically mark for deletion everything in the spam folder when it is
viewed, I placed this line at the bottom of the /etc/Muttrc file:
And to make it easier to train bogofilter, I placed
these two lines at the bottom of the /etc/Muttrc file: Thanks to Stefan Hollos for helping me to understand the whole fetchmail/procmail/mutt/bogofilter/sendmail business. Thanks to Eric Raymond for creating bogofilter, and all the developers of bogofilter, mutt, procmail, and fetchmail. References
Comments? Contact:
|