1 # Copyright (C) 2014-2019 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 = Email::Simple->create(
32 From => 'abc@example.com',
33 To => 'abc@example.com',
34 Cc => 'c@example.com, another-list@example.com',
35 'Content-Type' => 'text/plain',
36 Subject => 'list is fine',
37 'Message-ID' => '<MID@host>',
38 Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
40 body => "hello world\n",
42 my $addr = [ 'c@example.com', 'd@example.com' ];
43 ok(PublicInbox::MDA->precheck($s, $addr), 'Cc list is OK');
47 do_checks(Email::Simple->create(
49 From => 'a@example.com',
50 To => 'b@example.com',
51 Cc => 'c@example.com',
52 'Content-Type' => 'text/plain',
53 Subject => 'this is a subject',
54 'Message-ID' => '<MID@host>',
55 Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
57 body => "hello world\n",
62 do_checks(Email::Simple->create(
64 From => 'a@example.com',
65 To => 'b+plus@example.com',
66 Cc => 'John Doe <c@example.com>',
67 'Content-Type' => 'text/plain',
68 Subject => 'this is a subject',
69 'Message-ID' => '<MID@host>',
70 Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
72 body => "hello world\n",
77 my $recipient = 'b@example.com';
78 my $s = Email::Simple->create(
80 To => 'b@example.com',
81 Cc => 'c@example.com',
82 'Content-Type' => 'text/plain',
83 Subject => 'this is a subject',
84 'Message-ID' => '<MID@host>',
85 Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
87 body => "hello world\n",
89 ok(!PublicInbox::MDA->precheck($s, $recipient),
90 "missing From: is rejected");