So here's the deal.
Basically, I am looking for a convenient way to get spam from my Exchange 2010 mail server to my spam filter/proxy (whatever you want to call it) in a mail format for SpamAssassin to do its Bayesian filtering (Maildir or Mbox apparently).
I have created a gateway that filters mail and then passes it through to my Exchange server, as per this tutorial. From the research I have done it should be easy to apply the Bayesian filtering once the mail is in a format that it knows how to use:
sa-learn -mbox --spam ~/mbox/spam ~/mbox/bad-spam
Essentially, SpamAssassin needs a certain number of SPAM and HAM emails to do its thing and was thinking I could have users dump their emails into this public folder.
My initial inclination was to use something like IMAP2mbox and then dumping it into a directory on the SpamAssassin gateway. Therein lies my problem, it seems that this has become tricky to do with Exchange Server 2010 as there is no longer support for IMAP public folders built in.
I am stumped trying to come up with a way to get spam emails from my Exchange server into a format that SpamAssassin can use.
I am guessing there is a similar way to do this, but I'm not sure where to look next.
Exchange 2010 might allow using the domain/user/mailbox notation for accessing foreign user's mailboxes through IMAP. According to KB937359 this feature was originally removed from Exchange 2007, but re-introduced in SP1 Rollup 4. So it would be worth a try.
There is also DavMail which might be of some help - it gateways standard internet mail protocols through to Exchange over WebDAV or EWS. I have not tried, but accessing other user's mailboxes might work there using the DOMAIN\USERNAME\MAILBOX notation, public folders are apparently accessible as well.
The basic idea how to get the spam mail into SA is to simply set up fetchmail on your Postfix/Amavisd-Box to retrieve it and feed it to sa-learn. Make sure to specify the right database path for
sa-learn
so your updated bayes database is actually used by amavis. On an Ubunty system the command to do this should look like this:with your .fetchmailrc containing the necessary information for username, password, mailbox to access and the folder to fetch:
Specifying the
-v
parameter for the fetchmail command and the-D
parameter for sa-learn will give you some debug output. The fetchmail docs contain more useful information and some examples for a working fetchmail configuration.For my SBS2011 / Exchange 2011 20-person office server, I purchased the $100 license to Exchange Server Toolbox, which shoves Spam Assassin inline with Exchange's hub transport and augments Exchange's built-in Content Filtering.
I get fully configurable Spam Assassin, header and subject rewriting, and a secret backup of all messages that have passed through Exchange as .eml files.
I guess this sounds like a slashvertisement, but srsly this $100 gizmo works really keen for me.