🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.mail.sendmail
Article #2724

Re: How do I suppress text of bounced mail messages

#2724
From: Christopher Davis
Date: Tue, 17 Sep 1991 22:14
71 lines
2584 bytes
 NR> == Neil Rickert <rickert@mp.cs.niu.edu> 
 CS> == speicher@mwunix (Clay Speicher) writes:

 CS> One of the sys-admins here asked if there was a way to configure
 CS> sendmail in such a way that "MAILER-DAEMON" info messages will not
 CS> forward the text of the bounced message.

 NR>   Instead of using:

 NR> OPPostmaster

 NR>   use

 NR> OPERRORS

 NR> and alias ERRORS to a shell script to do the filtering.

Here's what we use.  As usual, no guarantees that it'll work for you,
but if you find a bug (especially if you fix it!) please let me know.

..signature follows it, so cut carefully.

--tear here--
#!/usr/bin/perl -- # -*-Perl-*-

# mailerdaemon.pl - send only the headers to Postmaster
# v0.1 by Christopher Davis <ckd@eff.org>

# for use with sendmail 5.65c+IDA1.4.4 & related versions
# how to use:

# in <machine>.m4, add a line:
#    define(POSTMASTERBOUNCE, mailer-errors)

# in the aliases file, add a line:
#    mailer-errors: "|/usr/local/etc/mailerdaemon.pl postmaster"
#    (defaults to postmaster, but command line overrides)

# This will forward bounces to postmaster after deleting the body
# of bounced messages (for privacy)

# assumes your /usr/ucb/mail takes '-s'.  Change if it doesn't.

$target = shift(@ARGV) || 'postmaster';

firstheaders: while (<>) {
    if (/^Subject:\s+(.*)$/) {$subject = $1;};
    last firstheaders if (/^$/);
}

unless ($pid = open(MAIL,"|-")) {
    exec '/usr/ucb/mail','-s',$subject,$target;
}

beforetag: while (<>) {
    print MAIL;
    last beforetag if (/Unsent message follows/);
}

headers: while (<>) {
    print MAIL;
    last headers if (/^$/);
}
    
@junk = <>;
---tear here---
-- 
Christopher Davis <ckd@eff.org>   | ELECTRONIC MAIL WORDS OF WISDOM #5:
System Manager & Postmaster       |     "Internet mail headers are
Electronic Frontier Foundation    |        not unlike giblets."
+1 617 864 0665    NIC: [CKD1]    |  -- Brian Reid <reid@decwrl.dec.com>
Technical Details
Message-ID: <CKD.91Sep17181445@eff.org>
Path: arc1-ca.pugleaf.net!wupost!uunet!iWarp.intel.com!eff!ckd
References: <speicher.685127900@mwunix> <1991Sep17.183603.18878@mp.cs.niu.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.mail.sendmail,alt.sources,comp.lang.perl
Path: arc1-ca.pugleaf.net!wupost!uunet!iWarp.intel.com!eff!ckd
From: ckd@eff.org (Christopher Davis)
Subject: Re: How do I suppress text of bounced mail messages
In-Reply-To: rickert@mp.cs.niu.edu's message of Tue, 17 Sep 1991 18:36:03 GMT
Message-ID: <CKD.91Sep17181445@eff.org>
Followup-To: comp.mail.sendmail
Sender: ckd@eff.org (Christopher Davis)
Organization: The Electronic Frontier Foundation
References: <speicher.685127900@mwunix> <1991Sep17.183603.18878@mp.cs.niu.edu>
Date: Tue, 17 Sep 1991 22:14:59 GMT
Lines: 71