4 use RT::Test tests => undef;
6 RT->Config->Set( MailCommand => 'sendmailpipe' );
7 RT->Config->Set( SetOutgoingMailFrom => 1 );
8 RT->Config->Set( OverrideOutgoingMailFrom => { Default => 'queue@example.invalid' } );
10 # Ensure that the fake sendmail knows where to write to
11 $ENV{RT_MAILLOGFILE} = RT::Test->temp_directory . "/sendmailpipe.log";
12 my $fake = File::Spec->rel2abs( File::Spec->catfile(
13 't', 'mail', 'fake-sendmail' ) );
14 RT->Config->Set( SendmailPath => $fake);
17 From: doesnotexist\@willbounce.invalid
18 Subject: This is a test of new ticket creation
24 # by default, MailError wants to crit or error the email message
25 # out to Screen, which scribbles all over the test output
26 no warnings 'redefine';
27 my $orig_mail_error = RT::Interface::Email->can('MailError');
28 local *RT::Interface::Email::MailError = sub { $orig_mail_error->( @_, LogLevel => undef ) };
29 RT::Test->send_via_mailgate($message);
33 open(LOG, "<", $ENV{RT_MAILLOGFILE}) or die "Can't open log file: $!";
35 while (my $line = <LOG>) {
36 $fcount++ if $line =~ /^-f/;
39 # RT_MAILLOGFILE will contain all the command line flags if you need them
40 is($fcount,1,"Only one -f specified to sendmail command");