home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / mail / sendmail / 2197 < prev    next >
Encoding:
Text File  |  1992-09-03  |  2.0 KB  |  66 lines

  1. Newsgroups: comp.mail.sendmail
  2. 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
  3. From: peter@merlin.acadiau.ca (Peter Steele)
  4. Subject: Re: Removing msg body in IDA for postmaster
  5. Message-ID: <peter.715528545@merlin>
  6. Sender: news@dragon.acadiau.ca
  7. Nntp-Posting-Host: merlin
  8. Organization: Acadia University
  9. References: <root.715272995@merlin> <1992Sep2.074845.9955@panix.com> <tih.715504703@barsoom>
  10. Date: Thu, 3 Sep 1992 13:55:45 GMT
  11. Lines: 53
  12.  
  13. >>2) Pipe it through a sed which chops it at the first blank line, then
  14. >>   forwards it to postmaster.
  15.  
  16. >The following is done in C, but performs basically the same function.
  17.  
  18. Here's the perl version I originally asked about. I've been using it
  19. now for several days and it works fine:
  20.  
  21. #!/usr/bin/perl -- # -*-Perl-*-
  22.  
  23. # mailerdaemon.pl - send only the headers to Postmaster
  24. # v0.1 by Christopher Davis <ckd@eff.org>
  25.  
  26. # for use with sendmail 5.65c+IDA1.4.4 & related versions
  27. # how to use:
  28.  
  29. # in <machine>.m4, add a line:
  30. #    define(POSTMASTERBOUNCE, mailer-errors)
  31.  
  32. # in the aliases file, add a line:
  33. #    mailer-errors: "|/usr/local/etc/mailerdaemon.pl postmaster"
  34. #    (defaults to postmaster, but command line overrides)
  35.  
  36. # This will forward bounces to postmaster after deleting the body
  37. # of bounced messages (for privacy)
  38.  
  39. # assumes your /usr/ucb/mail takes '-s'.  Change if it doesn't.
  40.  
  41. $target = shift(@ARGV) || 'postmaster';
  42.  
  43. firstheaders: while (<>) {
  44.     if (/^Subject:\s+(.*)$/) {$subject = $1;};
  45.     last firstheaders if (/^$/);
  46. }
  47.  
  48. unless ($pid = open(MAIL,"|-")) {
  49.     exec '/usr/ucb/mail','-s',$subject,$target;
  50. }
  51.  
  52. beforetag: while (<>) {
  53.     print MAIL;
  54.     last beforetag if (/Unsent message follows/);
  55. }
  56.  
  57. headers: while (<>) {
  58.     print MAIL;
  59.     last headers if (/^$/);
  60. }
  61.     
  62. @junk = <>;
  63. --
  64. Peter Steele        Unix Services Manager            peter.steele@acadiau.ca 
  65. Acadia Univ., Wolfville, NS, Canada B0P 1X0  902-542-2201  Fax: 902-542-4364
  66.