[Mimedefang] MIMEDefang - Restricting To Certain Email Addressees...?

nathan r. hruby nhruby at uga.edu
Mon Jun 19 10:08:19 EDT 2006

On Sun, 18 Jun 2006, Matt Dralle wrote:

> Hello,
> I just installed the latest version of MIMEDefang on a Redhat WS4 system and
> everything seems to be working alright at this point.
> I am primarily using it for filtering enclosures sent to a number of
> Majordomo email lists and rewriting them to a web server as a reinserted URL.
> Works great.
> BUT...  The problem is that I really don't want to filter out enclosures for
> all of the email accounts on my system, just the ones associated with the
> email  lists.  Since MIMEDefang is so tightly integrated with Sendmail, I'm
> not seeing how I can tell either MIMEDefang or Sendmail "only filter for
> these specific email destinations".
> Maybe there's a way I can just invoke MIMEDefang through a pipe in
> /etc/aliases instead of hooking it directly into Sendmail?

There's not a way to do run mimedefang from the command line and have it
do something functional, because it is a milter and relies on the contexts
that the sendmail milter API provides.  You can do what you want though
with something like this in mimedefang-filter.pl:

sub filter_recipient {
     my($recip, $sender, $ip, $host, $first, $helo, $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
     my %lists = ( 'list1 at address.com' => 1,
 		  'list2 at somethingelse.com' => 1);

     if ($lists{$recip}) {
       return ('CONTINUE', "ok");
     } else {
       return('ACCEPT_AND_NO_MORE_FILTERING', "$recip is not a mailing list");

Note though that you also do a similar test before you start stripping
attachments and just not strip attachments from non-list mail.

[ of course I'm sure this is horribly wrong and the more experienced users
will posit many more ways to accomplish this that are better.  Luckily the
best way to get the right answer to a question is to post the wrong one :) ]


nathan hruby <nhruby at uga.edu>
uga enterprise information technology services
core services  support
"In 1972 a crack commando unit was sent to
  prison by a military court for a crime they
  didn't commit...."

More information about the MIMEDefang mailing list