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