File Coverage

lib/Sisimai/Reason/ContentError.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::ContentError;
2 15     15   1599 use feature ':5.10';
  15         28  
  15         1250  
3 15     15   75 use strict;
  15         42  
  15         272  
4 15     15   57 use warnings;
  15         27  
  15         2438  
5              
6 3     3 1 9 sub text { 'contenterror' }
7 4     4 0 13 sub description { 'Email rejected due to a header format of the email' }
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.0.0
14 204     204 1 392 my $class = shift;
15 204   50     439 my $argv1 = shift // return undef;
16              
17 204         320 state $index = [
18             'improper use of 8-bit data in message header',
19             'message header size, or recipient list, exceeds policy limit',
20             'message mime complexity exceeds the policy maximum',
21             'routing loop detected -- too many received: headers',
22             'this message contain invalid mime headers',
23             'this message contain improperly-formatted binary content',
24             'this message contain text that uses unnecessary base64 encoding',
25             ];
26 204 100       348 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  1428         2030  
27 201         486 return 0;
28             }
29              
30             sub true {
31             # Rejected email due to header format of the email
32             # @param [Sisimai::Data] argvs Object to be detected the reason
33             # @return [Integer] 1: rejected due to content error
34             # 0: is not content error
35             # @see http://www.ietf.org/rfc/rfc2822.txt
36 2     2 0 5 return undef;
37             }
38              
39             1;
40             __END__