[Mimedefang] Question about resend_message() (Sendmail)

John Von Essen john at quonix.net
Thu Oct 18 09:15:40 EDT 2018


So Im finishing up my MD setup. I want clean mail delivered to my local user account, Spam I want sent to another alternate local user account. So instead of quarantine, the spam goes to a dedicated spam account where I can check it manually every once in a awhile. So my MD filter code looks like this:


            $SpamBox = 'essenz_spam at localhost';

            if ($hits < $req) {
                action_change_header("X-NoSpam-Score", "$hits ($score) $names");
            }
            if ($hits >= $req) {
                action_change_header("X-Spam-Score", "$hits ($score) $names");
                resend_message($SpamBox);
                action_discard();
            } 


The resend_message puts the spam in Sendmail’s clientmqueue, but…. 5 mins later when the queue flushes, the “resent” message gets delivered, which means it goes through MD again, which in turn gets filtered again by MD, resulting in a loop because it keeps getting flagged as spam then resent again.

Whats the easiest way to avoid this loop? Is there a way to put the message directly into the alternate mailbox (maybe add_recipient then delete_recipient)? The obvious option is I can add a snippet of code to MD to catch the loop and not perform a spam check on anything going to that alternate box.

Thanks
John



More information about the MIMEDefang mailing list