first pass RT4 merge, RT#13852
[freeside.git] / rt / t / mail / fake-sendmail
1 #!/usr/bin/env perl
2
3 # captures command line arguments so you can validate
4 # what is being generated in sendmailpipe
5
6 use strict;
7 use warnings;
8
9 die "No \$RT_MAILLOGFILE set in environment"
10     unless $ENV{RT_MAILLOGFILE};
11 open LOG, ">", $ENV{RT_MAILLOGFILE}
12     or die "Can't write to $ENV{RT_MAILLOGFILE}: $!";
13
14 my $needs_newline;
15 for (@ARGV) {
16     if (/^-/) {
17         print LOG "\n" if $needs_newline++;
18         print LOG $_;
19     } else {
20         print LOG " $_";
21     }
22 }
23 print LOG "\n";
24
25 1 while $_ = <STDIN>;
26
27 exit 0;