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 18     18   2014 use feature ':5.10';
  18         37  
  18         1317  
3 18     18   99 use strict;
  18         37  
  18         307  
4 18     18   70 use warnings;
  18         48  
  18         3284  
5              
6 3     3 1 23 sub text { 'contenterror' }
7 4     4 0 16 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 239     239 1 521 my $class = shift;
15 239   50     609 my $argv1 = shift // return undef;
16              
17 239         413 state $index = [
18             'header size exceeds maximum permitted',
19             'improper use of 8-bit data in message header',
20             'message header size, or recipient list, exceeds policy limit',
21             'message mime complexity exceeds the policy maximum',
22             'routing loop detected -- too many received: headers',
23             'this message contain invalid mime headers',
24             'this message contain improperly-formatted binary content',
25             'this message contain text that uses unnecessary base64 encoding',
26             ];
27 239 100       632 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  1912         3147  
28 236         625 return 0;
29             }
30              
31             sub true {
32             # Rejected email due to header format of the email
33             # @param [Sisimai::Data] argvs Object to be detected the reason
34             # @return [Integer] 1: rejected due to content error
35             # 0: is not content error
36             # @see http://www.ietf.org/rfc/rfc2822.txt
37 2     2 0 5 return undef;
38             }
39              
40             1;
41             __END__