-# faildir - emergency destination is maildir
-{
- my $faildir= "$home/faildir/";
- local $ENV{PI_EMERGENCY} = $faildir;
- local $ENV{HOME} = $home;
- local $ENV{ORIGINAL_RECIPIENT} = $addr;
- local $ENV{PATH} = $fail_path;
- my $in = <<EOF;
-From: Faildir <faildir\@example.com>
-To: You <you\@example.com>
-Cc: $addr
-Message-ID: <faildir\@example.com>
-Subject: faildir subject
-Date: Thu, 01 Jan 1970 00:00:00 +0000
-
-EOF
- run([$mda], \$in);
- ok(-d $faildir, "emergency exists");
- my @new = glob("$faildir/new/*");
- is(scalar(@new), 1, "message delivered");
- is(unlink(@new), 1, "removed emergency message");
-
- local $ENV{PATH} = $main_path;
- $in = <<EOF;
-From: Faildir <faildir\@example.com>
-To: $addr
-Content-Type: text/html
-Message-ID: <faildir\@example.com>
-Subject: faildir subject
-Date: Thu, 01 Jan 1970 00:00:00 +0000
-
-<html><body>bad</body></html>
-EOF
- my $out = '';
- my $err = '';
- run([$mda], \$in, \$out, \$err);
- isnt($?, 0, "mda exited with failure");
- is(length $out, 0, 'nothing in stdout');
- isnt(length $err, 0, 'error message in stderr');
-
- @new = glob("$faildir/new/*");
- is(scalar(@new), 0, "new message did not show up");
-
- # reject multipart again
- $in = $mime->as_string;
- $err = '';
- run([$mda], \$in, \$out, \$err);
- isnt($?, 0, "mda exited with failure");
- is(length $out, 0, 'nothing in stdout');
- isnt(length $err, 0, 'error message in stderr');
- @new = glob("$faildir/new/*");
- is(scalar(@new), 0, "new message did not show up");
-}
-