1 # Copyright (C) 2014-2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
12 my $recipient = 'foo@example.com';
13 ok(!PublicInbox::MDA->precheck($s, $recipient),
14 "wrong ORIGINAL_RECIPIENT rejected");
16 $recipient = 'b@example.com';
17 ok(PublicInbox::MDA->precheck($s, $recipient),
18 "ORIGINAL_RECIPIENT in To: is OK");
20 $recipient = 'c@example.com';
21 ok(PublicInbox::MDA->precheck($s, $recipient),
22 "ORIGINAL_RECIPIENT in Cc: is OK");
24 $recipient = [ 'c@example.com', 'd@example.com' ];
25 ok(PublicInbox::MDA->precheck($s, $recipient),
30 my $s = PublicInbox::Eml->new(<<'EOF');
33 Cc: c@example.com, another-list@example.com
34 Content-Type: text/plain
36 Message-ID: <MID@host>
37 Date: Wed, 09 Apr 2014 01:28:34 +0000
41 my $addr = [ 'c@example.com', 'd@example.com' ];
42 ok(PublicInbox::MDA->precheck($s, $addr), 'Cc list is OK');
46 do_checks(PublicInbox::Eml->new(<<'EOF'));
50 Content-Type: text/plain
51 Subject: this is a subject
52 Message-ID: <MID@host>
53 Date: Wed, 09 Apr 2014 01:28:34 +0000
60 do_checks(PublicInbox::Eml->new(<<'EOF'));
62 To: b+plus@example.com
63 Cc: John Doe <c@example.com>
64 Content-Type: text/plain
65 Subject: this is a subject
66 Message-ID: <MID@host>
67 Date: Wed, 09 Apr 2014 01:28:34 +0000
74 my $recipient = 'b@example.com';
75 my $s = PublicInbox::Eml->new(<<'EOF');
78 Content-Type: text/plain
79 Subject: this is a subject
80 Message-ID: <MID@host>
81 Date: Wed, 09 Apr 2014 01:28:34 +0000
85 ok(!PublicInbox::MDA->precheck($s, $recipient),
86 "missing From: is rejected");