[Mimedefang] skip all outgoing mail, not only to one relay

Jeff Rife mimedefang at nabs.net
Tue Feb 24 08:27:46 EST 2009

On 24 Feb 2009 at 12:02, Steffen Kaiser wrote:

> On Fri, 20 Feb 2009, Stefan König wrote:
> > i want to make MD skip ALL outgoing mail that is SEND through the server
> > via smtp to ANY relay.
> I don't know how to simply check where a mail will be relayed to. You know 
> where it comes from, but not where it goes to.

Here's what I use to check to see if a message is being relayed out to 
the Internet:

foreach my $recip (@Recipients)
  if ((${RecipientMailers{$recip}}[0] ne 'local') &&
      (!is_private_ip(${RecipientMailers{$recip}}[1])) &&
      (${RecipientMailers{$recip}}[1] !~ /$mylocaldomains\.$/))

    # do stuff for non-local recipients


is_private_ip() is a function that returns true if it is one of my LAN 

$mylocaldomains is a variable with a regex of domains that I am an MX 

Jeff Rife | "These are not scraps.  These are historic 
          |  remains of a once-great society of hair." 
          |         -- George Costanza 

More information about the MIMEDefang mailing list