summaryrefslogtreecommitdiff
path: root/rt/t/mail/fake-sendmail
blob: 44c237746c9c72a76b13079d1a8240ce42c5328a (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
26
27
#!/usr/bin/env perl

# captures command line arguments so you can validate
# what is being generated in sendmailpipe

use strict;
use warnings;

die "No \$RT_MAILLOGFILE set in environment"
    unless $ENV{RT_MAILLOGFILE};
open LOG, ">", $ENV{RT_MAILLOGFILE}
    or die "Can't write to $ENV{RT_MAILLOGFILE}: $!";

my $needs_newline;
for (@ARGV) {
    if (/^-/) {
        print LOG "\n" if $needs_newline++;
        print LOG $_;
    } else {
        print LOG " $_";
    }
}
print LOG "\n";

1 while $_ = <STDIN>;

exit 0;