As someone mentioned earlier, once mail data has been received, SMTP does not allow to reject for some recipients and accept for others. What you have to do is:
1.Amongst the recipients, check which are exempted
2. If all are exempted, accept message and deliver as it is
3. If none are exempted, do normal filtering
4. If some are exempted, others are not, resend the original message to exempted ones, delete them from "this" message, and do normal filtering.


All this, you can do from filter_end

Here is a part of code that does this. If we reject the original mail, we tell the list of recipients for which it was rejected as a part of the error string.

foreach $d_recip (@Recipients) {
@[EMAIL PROTECTED];
if($triple[0] eq "local"){
my $bool=0;
foreach $rowref (@arr){
if(@{$rowref}[0] eq $triple[2]){
$bool=1;
push(@exem,$d_recip);
last;
}
}
#if original mail is going to be rejected, calculate the list of recipients for which it is going to be rejected
if($bool==0 && defined($rejected)){
if($rejected){
$rejected.=", ";
}
$rejected.=$d_recip;
}
}
}
}
if(@exem){
if(resend_message(@exem)){
foreach $d_recip (@exem){
delete_recipient($d_recip);
}
} else {
md_syslog("warning","resend_message failed");
#accept the message
return 0;
}
}



Murat Isik wrote:


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:



_______________________________________________ Visit http://www.mimedefang.org and http://www.canit.ca MIMEDefang mailing list [EMAIL PROTECTED] http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to