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 26     26   2011 use feature ':5.10';
  26         67  
  26         2144  
3 26     26   165 use strict;
  26         54  
  26         567  
4 26     26   150 use warnings;
  26         48  
  26         5793  
5              
6 1     1 1 6 sub text { 'policyviolation' }
7 4     4 0 17 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 400     400 1 772 my $class = shift;
15 400   50     1263 my $argv1 = shift // return undef;
16              
17 400         1618 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             'message rejected due to local policy',
34             'messages with multiple addresses',
35             'rejected for policy reasons',
36             'protocol violation',
37             'the email address used to send your message is not subscribed to this group',
38             'the message was rejected by organization policy',
39             'this message was blocked because its content presents a potential',
40             'we do not accept messages containing images or other attachments',
41             'you have exceeded the allowable number of posts without solving a captcha',
42             'you have exceeded the the allowable number of posts without solving a captcha',
43             ];
44 400 100       850 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  9600         15873  
45 329         1107 return 0;
46             }
47              
48             sub true {
49             # The bounce reason is "policyviolation" or not
50             # @param [Sisimai::Data] argvs Object to be detected the reason
51             # @return [Integer] 1: is policy violation
52             # 0: is not policyviolation
53             # @since v4.22.0
54             # @see http://www.ietf.org/rfc/rfc2822.txt
55 2     2 0 8 return undef;
56             }
57              
58             1;
59             __END__