1 # Copyright (C) 2014-2015 all contributors <meta@public-inbox.org>
2 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
13 my $f = Email::Filter->new(data => $s->as_string);
15 my $recipient = 'foo@example.com';
16 ok(!PublicInbox::MDA->precheck($f, $recipient),
17 "wrong ORIGINAL_RECIPIENT rejected");
19 $recipient = 'b@example.com';
20 ok(PublicInbox::MDA->precheck($f, $recipient),
21 "ORIGINAL_RECIPIENT in To: is OK");
23 $recipient = 'c@example.com';
24 ok(PublicInbox::MDA->precheck($f, $recipient),
25 "ORIGINAL_RECIPIENT in Cc: is OK");
27 $recipient = [ 'c@example.com', 'd@example.com' ];
28 ok(PublicInbox::MDA->precheck($f, $recipient),
33 do_checks(Email::Simple->create(
35 From => 'a@example.com',
36 To => 'b@example.com',
37 Cc => 'c@example.com',
38 'Content-Type' => 'text/plain',
39 Subject => 'this is a subject',
40 'Message-ID' => '<MID@host>',
41 Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
43 body => "hello world\n",
48 do_checks(Email::Simple->create(
50 From => 'a@example.com',
51 To => 'b+plus@example.com',
52 Cc => 'John Doe <c@example.com>',
53 'Content-Type' => 'text/plain',
54 Subject => 'this is a subject',
55 'Message-ID' => '<MID@host>',
56 Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
58 body => "hello world\n",
63 my $recipient = 'b@example.com';
64 my $s = Email::Simple->create(
66 To => 'b@example.com',
67 Cc => 'c@example.com',
68 'Content-Type' => 'text/plain',
69 Subject => 'this is a subject',
70 'Message-ID' => '<MID@host>',
71 Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
73 body => "hello world\n",
75 my $f = Email::Filter->new(data => $s->as_string);
76 ok(!PublicInbox::MDA->precheck($f, $recipient),
77 "missing From: is rejected");