[Mimedefang] Accept mail before processing

David F. Skoll dfs at roaringpenguin.com
Tue Mar 14 12:48:28 EST 2006

John Rudd wrote:

> I can suggest a solution only if you drop the "with mimedefang" part.

That's fairly radical. :-)  You can do it with MIMEDefang as follows:

sub filter_begin {
    if ($RealRelayAddr ne '') {
        # Not from localhost... put into clientmqueue and quit
        if (resend_message_specifying_mode('-odd', \@Recipients)) {
	    $TerminateAndDiscard = 1;
        # Doh... could not remail message
        return action_bounce("Doh!! Unable to resubmit message.");

    # Normal filtering code here...

This is a horrible, ugly hack.  I do NOT recommend it.  Basically,
what it does is submit all incoming mail to the clientmqueue for re-scanning.
This simulates mailscanner, but will cause mail delays (even though initial
submission will be quick.)

A better, though still ugly, solution is to change the if clause to
something like:

    if ($RealRelayAddr =~ /^192\.168\.1\./) { ... }

where the regexp matches IP addresses from which you expect senders to
connect directly with their MUAs.

That way, you only do the nasty hack for people connecting with MUAs, and
use normal "real-time" processing for everyone else.



More information about the MIMEDefang mailing list