[Mimedefang] Don't call spamassassin for outbound e-mails

Barton L. Phillips barton at applitec.com
Sat Dec 10 13:08:32 EST 2005

>I´d like to use SpamAssassin to check just my inbound e-mails. I use SA with
>MIMEDefang and Sendmail.
>How should I do configure mimedefang to don't call SA for outbound e-mails?
Here is what I did. Also some additional stuff,  but the first 'if' is 
how I keep from filtering my outgoing through spamassassin. I hope this 
helps. Note the first comment, you need the -s flag set to look at senders.

# Add a filter sender. Must start mimedefang with -s flag
# I want to extend this to read a black list file. TBD

sub filter_sender {
  my ($sender, $ip, $hostname, $helo) = @_;

  # md_syslog('info', "Filter_sender: $helo, $sender, $ip, $hostname");

  # If this is coming from me don't do any thing just send it out

  if ($ip eq "" or $ip =~ /192\.168\.1\./) {
    md_syslog('info', "Filter_sender: From ME: sender=$sender");
    return ('ACCEPT_AND_NO_MORE_FILTERING', "ok");

  # Also keep people from helo-ing me with my own address
  if ($helo =~ 
/(?:applitec\.com)|(?:bartonphillips\.com)|(?:68\.122\.243\.210)/i) {
    if ($ip ne "" and
    $ip ne "") {
      md_syslog('info', "Filter_sender error: spoof helo: helo=$helo, 
ip=$ip, sender=$sender");
      return('REJECT', "Go away... $ip is not in applitec.com");

  # mail is not from our ip and yet the sender claims to be from here

  if (($sender =~ 
      (($ip ne "") and ($ip ne "") and ($ip !~ 
/192\.168\.1\./))) {
    md_syslog('info', "Filter_sender error: spoofed sender: 
sender=$sender, ip=$ip, hostname=$hostname, helo=$helo");

    # For glen and alan
    if(($sender =~ /(?:glen)|(?:ghumphrey)|(?:alan)|(?:barton)/) and
       ($hostname =~ 
      md_syslog('info', "Filter_sender error: spoofer is glen or alan");
      return ('CONTINUE', "ok");
    return('REJECT', "Go away... spoofing sender $sender from $ip");
  return ('CONTINUE', "ok");

# </blp date="11/2/2005">
# DO NOT delete the next line, or Perl will complain.

Barton L. Phillips
Applied Technology Resources, Inc.
Tel: (818)652-9850
Web: http://www.applitec.com

More information about the MIMEDefang mailing list