blob: 794e0a104fe509c9faeb767ae8bcbc14d5b62471 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/env perl
use Email::Simple;
use IO::File;
use strict;
use warnings;
die usage() unless $#ARGV == 0;
my $path = shift;
local $/;
my $email = Email::Simple->new(<>);
my $msgid = $email->header('Message-ID');
$msgid =~ s/<(.*)@.*>/$1/;
my $fh = IO::File->new(">$path/$msgid") ||
die "Couldn't write to $path/$msgid: $!\n";
print $fh $email->as_string;
$fh->close;
sub usage {
"Usage: $0 path\n";
}
|