File Coverage

lib/Sisimai/Reason/PolicyViolation.pm
Criterion Covered Total %
statement 18 18 100.0
branch 2 2 100.0
condition 1 2 50.0
subroutine 7 7 100.0
pod 2 4 50.0
total 30 33 90.9


line stmt bran cond sub pod time code
1             package Sisimai::Reason::PolicyViolation;
2 23     23   1246 use feature ':5.10';
  23         38  
  23         1706  
3 23     23   118 use strict;
  23         36  
  23         399  
4 23     23   90 use warnings;
  23         35  
  23         4245  
5              
6 1     1 1 5 sub text { 'policyviolation' }
7 4     4 0 14 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 345     345 1 656 my $class = shift;
15 345   50     1160 my $argv1 = shift // return undef;
16              
17 345         815 state $index = [
18             'an illegal attachment on your message',
19             'because the recipient is not accepting mail with ', # AOL Phoenix
20             'by non-member to a members-only list',
21             'closed mailing list',
22             'denied by policy',
23             'dmarc policy',
24             'email not accepted for policy reasons',
25             # http://kb.mimecast.com/Mimecast_Knowledge_Base/Administration_Console/Monitoring/Mimecast_SMTP_Error_Codes#554
26             'email rejected due to security policies',
27             'header are not accepted',
28             'header error',
29             'local policy violation',
30             'message bounced due to organizational settings',
31             'message given low priority',
32             'message not accepted for policy reasons',
33             'messages with multiple addresses',
34             'rejected for policy reasons',
35             'protocol violation',
36             'the email address used to send your message is not subscribed to this group',
37             'this message was blocked because its content presents a potential',
38             'we do not accept messages containing images or other attachments',
39             'you have exceeded the allowable number of posts without solving a captcha',
40             'you have exceeded the the allowable number of posts without solving a captcha',
41             ];
42 345 100       779 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  7590         10966  
43 269         684 return 0;
44             }
45              
46             sub true {
47             # The bounce reason is "policyviolation" or not
48             # @param [Sisimai::Data] argvs Object to be detected the reason
49             # @return [Integer] 1: is policy violation
50             # 0: is not policyviolation
51             # @since v4.22.0
52             # @see http://www.ietf.org/rfc/rfc2822.txt
53 2     2 0 5 return undef;
54             }
55              
56             1;
57             __END__