home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.mail.sendmail
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!ubc-cs!utcsri!torn!csd.unb.ca!morgan.ucs.mun.ca!nstn.ns.ca!dragon.acadiau.ca!merlin!peter
- From: peter@merlin.acadiau.ca (Peter Steele)
- Subject: Re: Removing msg body in IDA for postmaster
- Message-ID: <peter.715528545@merlin>
- Sender: news@dragon.acadiau.ca
- Nntp-Posting-Host: merlin
- Organization: Acadia University
- References: <root.715272995@merlin> <1992Sep2.074845.9955@panix.com> <tih.715504703@barsoom>
- Date: Thu, 3 Sep 1992 13:55:45 GMT
- Lines: 53
-
- >>2) Pipe it through a sed which chops it at the first blank line, then
- >> forwards it to postmaster.
-
- >The following is done in C, but performs basically the same function.
-
- Here's the perl version I originally asked about. I've been using it
- now for several days and it works fine:
-
- #!/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 = <>;
- --
- Peter Steele Unix Services Manager peter.steele@acadiau.ca
- Acadia Univ., Wolfville, NS, Canada B0P 1X0 902-542-2201 Fax: 902-542-4364
-