aboutsummaryrefslogtreecommitdiffstats
path: root/t/delivert
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2014-11-21 11:02:46 -0500
committerBrian Cully <bjc@kublai.com>2014-11-23 14:19:29 -0500
commitcacbab512d4102e6db19c6487c4d291006dd0fda (patch)
treebc0e623db6b94384c9305529311148712786426c /t/delivert
downloadspamcat-cacbab512d4102e6db19c6487c4d291006dd0fda.tar.gz
spamcat-cacbab512d4102e6db19c6487c4d291006dd0fda.zip
Initial commit.
Diffstat (limited to 't/delivert')
-rwxr-xr-xt/delivert25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/delivert b/t/delivert
new file mode 100755
index 0000000..63c3864
--- /dev/null
+++ b/t/delivert
@@ -0,0 +1,25 @@
+#!/usr/bin/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";
+}