[Mimedefang] exceptions based on recipient?

Murat Isik muratisik at megatek.com.tr
Thu Jan 29 16:44:38 EST 2004


Hello,

I am relatively new to mimedefang and perl but I loved using it for
attachment filtering and so on. However I have a problem about which all my
googleing turned out to be useless. I want to filter attachments based on
recipients. It is like if I have ten mail accounts, for nine of them
action_quarantine should work but for the tenth should not. Then I found
some sites with advanced mimedefang filters and got some ideas from them and
tried to accomplish this:

sub filter_multipart ($$$$$) {
    my($entity, $fname, $ext, $type, $rcpt_addr) = @_;

    if ((filter_bad_filename($entity)) && !($rcpt_addr =~
/^<?test\@test.com>?$/i)) {
        md_graphdefang_log('bad_filename', $fname, $type);
        action_notify_administrator("A MULTIPART attachment of type $type,
named $fname was dropped.\n");
        return action_drop_with_warning("An attachment of type $type, named
$fname was removed from this document as it\nconstituted a security hazard.
If you require this document, please contact\nthe sender and arrange an
alternate means of receiving it.\n");
    }


So if my domain is test.com, the user test at test.com will receive all the
attachments but the rest will not. However it didnot work. I also tried it
as !($rcpt_addr =~ /^test\@test.com$/i) but still did not work. I am not a
perl coder so ı cant se what wrong here.

Can anybody please help?

Have a nice day.

Murat Isik




More information about the MIMEDefang mailing list