[Mimedefang] Bounce AND send a copy?

Doug Brott brott at redh.com
Wed Sep 29 20:07:42 EDT 2004


Kelson wrote:

> Tim Boyer wrote:
>
>> Is there any way for the same message to be bounced, AND send a copy to
>> postmaster?  Until I get comfortable with SpamAssassin, I'd like 
>> Postmaster
>> to take a look at what's bouncing.
>
>
> Alternatively, you can quarantine the message (using 
> quarantine_entire_message) instead of sending it to your postmaster.
>
I quarantine all of my "deleted" messages just in case.  I also store 
the scores at the top so they are easy to fine if I look through the 
logs.  A snippet of my mimedefang-filter follows (in filter_end):

            if ($hits >= $req) {
                action_change_header("X-Spam-Score", "$hits ($score) 
$names");
                md_graphdefang_log('spam', $hits, $RelayAddr);

                # If you find the SA report useful, add it, I guess...
                action_add_part($entity, "text/plain", "-suggest",
                                "$report\n",
                                "SpamAssassinReport.txt", "inline");
                if ($hits > $MaximumHitsAllowed)
                {
                  # Delete mails that we will call "Definite" SPAM
                  $msg  = "Spamassassin Caught this message\n";
                  $msg .= "================================\n";
                  $msg .= "Score = $hits\n";
                  $msg .= "Limit = $MaximumHitsAllowed\n";
                  $msg .= "================================\n";
                  $msg .= $report;
                  action_quarantine_entire_message($msg);
                  action_discard();
                }
            } else {
                # Delete any existing X-Spam-Score header?
                action_delete_header("X-Spam-Score");
            }

=======

I also have a script file that runs nightly at 11:59pm to move all of 
the quarantined messages to subdirectories.  I should rewrite it to do 
"yesterday's" files because occasionally there are a few leftover that 
arrived between 11:59pm and 12:00am.

#!/bin/bash

export YMD=`date +"%Y %m %d"`

Y=`echo $YMD | awk {'print $1'}`
M=`echo $YMD | awk {'print $2'}`
D=`echo $YMD | awk {'print $3'}`

date=`date +"qdir-$Y-$M"`
path=${date}/${D}

cd /var/spool/MD-Quarantine/

#mv $date-* $date

mkdir -p $path
mv $date-$D-* $path

-- 
Doug Brott
brott at redh.com



More information about the MIMEDefang mailing list