[Mimedefang] add_recipient

Jason Englander jason at englanders.cc
Thu Feb 21 12:05:13 EST 2002


On Thu, 21 Feb 2002, David F. Skoll wrote:

> On Thu, 21 Feb 2002, Jason Englander wrote:
>
> > I need to take any mail passing through a mail server running MD
> > addressed to a certain domain and send it to in at mail.foo.org and
> > take any mail coming from that domain through this server and send
> > it to out at mail.foo.org  This is working just fine with stream_by_domain
> > and add_recipient.  ...but I need the sender on the *@mail.foo.org copy of
> > the message to be changed to me/root/whatever,
>
> Milter has no provisions for doing that.  If you really want that, you need
> to re-invoke Sendmail to re-send the message (potentially cancelling
> the original, depending on your intent.)

I do need the original to go where it was supposed to go too.

What do you think about something like this?

sub filter_end {
  my $OrigSender = $Sender;
  if (lc($Domain) eq 'foo.org') {
    $Sender = 'postmaster at mydomain.org';
    resend_message('in at mail.foo.org');
  }
  $Sender = $OrigSender;
  if ($Sender =~ /\@foo\.org\>$/i) {
    $Sender = 'postmaster at mydomain.org';
    resend_message('out at mail.foo.org');
  }
}

This would call (more or less) sendmail -f $Sender -odi on the original,
right?

I have a few other potential candidates for doing this, but so far this
one (if it works) would seem to be the least hairy and resource hogging
way to do it.

Thanks,
  Jason





More information about the MIMEDefang mailing list