[Mimedefang] Action Bounce Question

Matthew.van.Eerde at hbinc.com Matthew.van.Eerde at hbinc.com
Mon Jan 17 15:19:59 EST 2005


Jeff Grossman wrote:
> I must have something wrong in my filter.  I am getting the following
> error: 
> 
> Jan 17 10:57:28 mail mimedefang.pl[29405]: action_bounce called
> outside of messa
> ge context
> 
> 
> Here is the part of my filter which is triggering this: (it is in
> filter-recipient)
> 
> sub filter_recipient {
> 
> my($recip, $sender, $ip, $host, $first, $helo, $rcpt_mailer,
>         $rcpt_host, $rcpt_addr) = @_;
> 
> $recip2 = $recip;
> $recip2 =~ tr/<>//d;
> $recip2 = lc($recip2);
> 
> if ($recip2 eq 'signalhill at turners.com' or
>         $recip2 eq 'reseda at turners.com') {
>                 action_bounce("The intended recipient is not allowed
> to receive
> e-mail");
>                 return action_notify_administrator("Incorrect
> Recipient $recip2"
> );
> }
> 
> 
> Thanks for the help.

To reject a recipient, do a return ('REJECT', 'because we do not like you');

See the documentation - man mimedefang-filter
filter_recipient must return a two-to-five element list whose interpretation is the same as for filter_relay and filter_sender.
...
($code, $msg, $smtp_code, $smtp_dsn, $delay).  $msg speci­fies  the  text  message  to  use for the SMTP reply.  If $smtp_code and $smtp_dsn are  supplied,  they  become  the SMTP numerical reply code and the enhanced status delivery code (DSN code).   If  they  are  not  supplied,  sensible defaults  are  used.  $delay specifies a delay in seconds; the C milter code will sleep  for  $delay  seconds  before returning the reply to Sendmail.  $delay defaults to zero.
...
 sub filter_recipient {
            my ($recipient, $sender, $ip, $hostname, $first, $helo,
                   $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
            if ($sender =~ /^<?spammer\@badguy\.com>?$/i) {
                 if ($recipient =~ /^<?postmaster\@mydomain\.com>?$/i) {
                      return ('CONTINUE', "ok");
                 }
                 return ('REJECT', 'Sorry; spammer at badguy.com is blacklisted.');
            }
            return ('CONTINUE', "ok");
       }
...




More information about the MIMEDefang mailing list