File Coverage

lib/Sisimai/Reason/PolicyViolation.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition 2 2 100.0
subroutine 7 7 100.0
pod 2 4 50.0
total 30 32 93.7


line stmt bran cond sub pod time code
1             package Sisimai::Reason::PolicyViolation;
2 32     32   2973 use v5.26;
  32         144  
3 32     32   200 use strict;
  32         70  
  32         2581  
4 32     32   146 use warnings;
  32         63  
  32         7584  
5              
6 1     1 1 21 sub text { 'policyviolation' }
7 4     4 0 46 sub description { 'Email rejected due to policy violation on a destination host' }
8             sub match {
9             # Try to match that the given text and regular expressions
10             # @param [String] argv1 String to be matched with regular expressions
11             # @return [Integer] 0: Did not match
12             # 1: Matched
13             # @since v4.22.0
14 402     402 1 1507 my $class = shift;
15 402   100     1376 my $argv1 = shift // return 0;
16              
17 401         747 state $index = [
18             "because the recipient is not accepting mail with ", # AOL Phoenix
19             "closed mailing list",
20             "delivery not authorized, message refused",
21             "denied by policy",
22             # http://kb.mimecast.com/Mimecast_Knowledge_Base/Administration_Console/Monitoring/Mimecast_SMTP_Error_Codes#554
23             "email rejected due to security policies",
24             "for policy reasons",
25             "local policy violation",
26             "message bounced due to organizational settings",
27             "message given low priority",
28             "message was rejected by organization policy",
29             "protocol violation",
30             "you're using a mass mailer",
31             ];
32 401 100       1006 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  4812         9165  
33 375         1285 return 0;
34             }
35              
36             sub true {
37             # The bounce reason is "policyviolation" or not
38             # @param [Sisimai::Fact] argvs Object to be detected the reason
39             # @return [Integer] 1: is policy violation
40             # 0: is not policyviolation
41             # @since v4.22.0
42             # @see http://www.ietf.org/rfc/rfc2822.txt
43 2     2 0 5 return 0;
44             }
45              
46             1;
47             __END__