Piping mail back into MailScanner?

Furnish, Trever G TGFurnish at HERFF-JONES.COM
Mon Aug 18 17:41:56 IST 2003


For testing, I use some variant of the following.  It cats an mbox format
file into formail, which splits the file into individual messages and passes
them off one at a time to sendmail, which in turn just drops them into the
incoming mail queue, where MailScanner picks them up.

If you want to test from a different system, take out the DeliveryMode and
QueueDirectory options below.  Be sure to update your email address in the
-i line.  The -I lines are just to make things prettier.

Basic command is:

cat spamarchive.mbox \
        | formail -30 -c -e -n 1 \
                -I X-MailScanner-Information: \
                -I X-MailScanner: \
                -I X-MailScanner-SpamCheck: \
                -I X-MailScanner-SpamScore: \
                -I X-Spam-Status: \
                -I X-Spam-Flag: \
                -I X-scanner: \
                -I X-Spam-Checker-Version: \
                -I X-Spam-Report: \
                -I X-Spam-Level: \
                -I X-SPAM-Tag: \
                -I X-SpamPal: \
                -I X-Spam-Rating: \
                -i "To: youraddress at yourdomain.com" \
                -s /usr/sbin/sendmail -t -oi -ODeliveryMode=queueonly \
                   -OQueueDirectory=/var/spool/mqueue.in

The spamarchive.gz file is a gzipped mbox file.  The formail options are:
-30     This is limiting the max # of msgs sent to 30.
        Take it out if you want to send them all.  Good to test first with
just a few.
-e      "allow 'From ' lines without preceding blank lines."
-n 1    "only run 1 external process at a time"
-I      ...removes these headers
-i      ...renames the old version of this header and adds a new one.
-s      ...split into multiple messages and pass each message to
        something - in this case, sendmail.

The sendmail options (and order is important -- -t before -oi) are:
-t      ...collect a message from stdin, using it's To header.
-oi     ...ignore <CR>.<CR>, which would normally end a message - only
accept an end-of-file.
-ODeliveryMode  ...sets the deliverymode to queuing, so MailScanner has a
chance to filter it.
-OQueueDirectory        ...sets the queue directory to the inbound
mailscanner queue.

Formail is usually distributed with procmail.  My incoming directory is
/var/spool/mqueue.in - if yours is different, change the command above as
needed.

HTH,
Trever

> -----Original Message-----
> From: Damien McKenna [mailto:damien at MC-KENNA.COM]
> Sent: Monday, August 18, 2003 11:33 AM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Piping mail back into MailScanner?
>
>
> I've got some 1000 spam messages that I collated before I got
> spam assassin
> working and I'd like to run them back through it to aid in my
> configuration
> fine-tuning.  Is there any way to pipe an mbox file full of
> messages through
> MailScanner or should I give up on a lost cause?
> --
> Damien McKenna  damien at mc-kenna.com  http://mc-kenna.com/
>



More information about the MailScanner mailing list