File Coverage

lib/Sisimai/Reason/BadReputation.pm
Criterion Covered Total %
statement 20 20 100.0
branch 4 4 100.0
condition 4 4 100.0
subroutine 7 7 100.0
pod 2 4 50.0
total 37 39 94.8


line stmt bran cond sub pod time code
1             package Sisimai::Reason::BadReputation;
2 48     48   3480 use v5.26;
  48         210  
3 48     48   329 use strict;
  48         132  
  48         1364  
4 48     48   229 use warnings;
  48         123  
  48         14265  
5              
6 11     11 1 53 sub text { 'badreputation' }
7 4     4 0 19 sub description { 'Email rejected due to an IP address reputation' }
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 v5.0.0
14 1389     1389 1 4364 my $class = shift;
15 1389   100     5636 my $argv1 = shift // return 0;
16              
17 1388         2323 state $index = [
18             "has been temporarily rate limited due to ip reputation",
19             "ip/domain reputation problems",
20             "likely suspicious due to the very low reputation",
21             "none/bad reputation", # t-online.de
22             "poor email reputation score",
23             "sending mta's poor reputation",
24             "temporarily deferred due to unexpected volume or user complaints", # Yahoo Inc.
25             ];
26 1388 100       3977 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  9716         18971  
27 1376         4831 return 0;
28             }
29              
30             sub true {
31             # The bounce reason is "badreputation" or not
32             # @param [Sisimai::Fact] argvs Object to be detected the reason
33             # @return [Integer] 1: is badreputation
34             # 0: is not badreputation
35             # @see http://www.ietf.org/rfc/rfc2822.txt
36             # @since v5.0.0
37 974     974 0 3561 my $class = shift;
38 974   100     3668 my $argvs = shift // return 0;
39              
40 973 100       3418 return 1 if $argvs->{'reason'} eq 'badreputation';
41 972         4915 return __PACKAGE__->match(lc $argvs->{'diagnosticcode'});
42             }
43              
44             1;
45             __END__