Friday, 6 February 2009

sendmail teaching procedure

When the setup is finished our mail relays need to be "taught" some manners :P... this is the way:

If we use RFC 2822 mail-queue messages we symply send them to sa-lern thusly:
sa-learn -p /etc/mail/MailScanner/spam.assassin.prefs.conf --progress --ham /dir/with/spam/*

This way though getting the mail back to the customer without letting him/her know proved to be quite a pain... so we switch to df/qf mail messages which resulted in a different process:
1. Get the ham in a directory called 20090101 lets say
2  Use Julian's script to make the qf/df into mbox files:
cd /var/spool/notspam/ (where the 20090101 dir is)
df2mbox * (this will create the spam.number file we need)

3. Make spammassassin learn the messages as ham
sa-learn -p /etc/mail/MailScanner/spam.assassin.prefs.conf --progress --ham --mbox spam.20090101

4. And finally send the email without the client knowing a thing :)
/usr/lib/sendmail -OQueueDirectory=/var/spool/notspam/20100103 -OTimeout.queuereturn=51d -OTimeout.queuewarn=0 -q -v

Thats it :)