[Mimedefang] whitelisting in mimedefang-filter

tonj tonj at freeuk.com
Thu Jul 15 18:06:40 EDT 2010

I use md to reject all incoming html email but I want to manually whitelist
some email addresses. I found instructions at:
but they're not working so I must be doing something wrong. My md-filter
contains this:

# Detect and load Perl modules

$IncomingWhitelist{'whitelisteddomain.com'} = 1;
$IncomingWhitelist{'sender at whitelisteddomain.com'} = 1;

sub filter_recipient {
    my @senderparts = split(/@/, $sender);
    my $senderdom = $senderparts[1];
    $senderdom =~ s/[<>]//g;
    if (
       (exists $IncomingWhitelist{lc($sender)}) ||
       (exists $IncomingWhitelist{lc($senderdom)}) ||
       (exists $IncomingWhitelist{lc($recipient)}) )
    return ('ACCEPT_AND_NO_MORE_FILTERING', "ok");
sub filter {
    my($entity, $name, $ext, $type) = @_;
    if ($type =~ /text.html/i) {
        return action_bounce("HTML mail not allowed here, plain text

the global html rejection works fine but email from
sender at whitelisteddomain.com should be allowed through however it gets
rejected just like the rest. Any ideas appreciated. 

More information about the MIMEDefang mailing list