first pass RT4 merge, RT#13852
[freeside.git] / rt / t / mail / fake-sendmail
diff --git a/rt/t/mail/fake-sendmail b/rt/t/mail/fake-sendmail
new file mode 100644 (file)
index 0000000..44c2377
--- /dev/null
@@ -0,0 +1,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;