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)
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 do_checks(Email::Simple->create(
32 From => 'a@example.com',
33 To => 'b@example.com',
34 Cc => 'c@example.com',
35 'Content-Type' => 'text/plain',
36 Subject => 'this is a subject',
37 'Message-ID' => '<MID@host>',
38 Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
40 body => "hello world\n",
45 do_checks(Email::Simple->create(
47 From => 'a@example.com',
48 To => 'b+plus@example.com',
49 Cc => 'John Doe <c@example.com>',
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',
55 body => "hello world\n",
60 my $recipient = 'b@example.com';
61 my $s = Email::Simple->create(
63 To => 'b@example.com',
64 Cc => 'c@example.com',
65 'Content-Type' => 'text/plain',
66 Subject => 'this is a subject',
67 'Message-ID' => '<MID@host>',
68 Date => 'Wed, 09 Apr 2014 01:28:34 +0000',
70 body => "hello world\n",
72 ok(!PublicInbox::MDA->precheck($s, $recipient),
73 "missing From: is rejected");