[Mimedefang] filter_recipient

scohen scohen at scohen.mysticjj.com
Fri Nov 12 10:43:43 EST 2004

On Fri, 12 Nov 2004, Michael Lang wrote:

> On Thu, 2004-11-11 at 17:08, scohen wrote:
> > I wrote a subroutine using filter_recipient to whitelist. It reads
> > /etc/mail/access, looks for OK or RELAY, and whitelists those entries. It
> > works for $sender and $recipient but not for $rcpt_host. Using md_syslog I found
> > that while I am getting values for $recipient, $sender, $ip, $hostname,
> > $first, and $helo, I am not getting vaulues for $rcpt_mailer $rcpt_host or
> > $rcpt_address.
> >
> > Nov 11 08:45:55 open1 mimedefang.pl[29791]: $rcpt_host is ?
> > Nov 11 08:45:55 open1 mimedefang.pl[29791]: $rcpt_addr is ?
> > Nov 11 08:45:55 open1 mimedefang.pl[29791]: $rcpt_mailer is ?
> >
> > I was wondering why this could be? I am assigning the variables just like
> > the mimedefang-filter suggests:
> >
> > sub filter_recipient {
> >      my ($recipient, $sender, $ip, $hostname, $first, $helo,
> >          $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
> >
> what excatly are you trying to do ? if you already have
> in your /etc/mail/access file your mail should never reach the filter :)
I am trying to whitelist, not blacklist. In other words, I setting it up
so some domains do not get checked by mimedefang. In /etc/mail/access that
would be the OK and RELAY entries not the REJECT entries. Of course I said
that above.

> maybe you should read mimedefang.pl to get the correct Names,
>     $RelayAddr = "";
>     $RealRelayAddr = "";
>     $RelayHostname = "";
>     $RealRelayHostname = "";

I did read mimedefang.pl and I typed man mimedefang-filter, and I am
using the correct variables. From mimedefang.pl:

my($rcpt_mailer, $rcpt_host, $rcpt_addr);

>From the man page on mimedefang-filter:

       filter_recipient is passed  nine  arguments:   $recipient  is  the
       envelope  address  of the recipient and $sender is the envelope e-
       mail  address  of  the  sender  (for  example,   "<dfs at roaringpen-
       guin.com>").   The addresses may or may not be surrounded by angle
       brackets.  $ip and $name are the IP address and host name  of  the
       SMTP relay.  $first is the envelope address of the first recipient
       for this message, and $helo is the argument  to  the  SMTP  "HELO"
       command.   The  last three arguments, $rcpt_mailer, $rcpt_host and
       $rcpt_addr are the Sendmail mailer, host and  address  triple  for
       the   recipient  address.   For  example,  for  local  recipients,
       $rcpt_mailer is likely to be "local", while for remote recipients,
       it is likely to be "esmtp".

> Kind regards
> Michael Lang
> >
> > Thanks for the help,
> >
> > Steve Cohen
> >
Steve Cohen

More information about the MIMEDefang mailing list