/[perl]/remail.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /remail.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Thu May 8 14:58:24 2003 UTC (16 years, 1 month ago) by dpavlin
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +3 -2 lines
File MIME type: text/plain
sort bind zone

1 #!/usr/bin/perl -w
2
3 #
4 # read mbox with error messages from mail server (like
5 # Returned mail: Host unknown (Name server...
6 # and dump e-mails which are returned so that they can be feeded
7 # back to sendmail using
8 # $ sendmail -t < mail.0
9 #
10
11 my $b;
12
13 my $nr=1;
14
15 while(<>) {
16 if (m,^Content-Type: message/rfc822,) {
17 $foo=<>;
18 while ($foo !~ m,^Return-Path,) { $foo=<>; };
19 if ($foo !~ m,^Return-Path: <MAILER-DAEMON>,) {
20 open(M,"> mail.$nr") || die $!;
21 print "$nr: $foo\n\t$b\n";
22 print M $foo;
23 chomp $b;
24 while($foo=<>) {
25 last if ($foo=~m,^$b,);
26 print M $foo;
27 }
28 close(M);
29 $nr++;
30 }
31 }
32 $b=$_;
33 }
34

  ViewVC Help
Powered by ViewVC 1.1.26