use Email::MIME::Header::header_raw to read Message-ID
[ssoma.git] / ssoma-mda
blob8d16627261a8b814ff043f06d8a1ef5606ab56af
1 #!/usr/bin/perl -w
2 # Copyright (C) 2013-2016 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # This is the command-line mail delivery agent for servers.
5 # Try to keep this small as it may be invoked frequently for each message
6 # delivered.
7 my $usage = "ssoma-mda [-1] /path/to/git/repo < /path/to/rfc2822_message";
8 use strict;
9 use warnings;
10 use Ssoma::MDA;
11 use Ssoma::Git;
12 use Email::MIME;
13 my $once = $ARGV[0] eq "-1";
14 my $repo = pop @ARGV or die "Usage: $usage\n";
15 my $git = Ssoma::Git->new($repo);
16 my $mda = Ssoma::MDA->new($git);
17 my $mime;
19 local $/;
20 $mime = Email::MIME->new(<STDIN>);
22 $mda->deliver($mime, $once);