File Coverage

lib/Sisimai/Reason/SecurityError.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition 1 2 50.0
subroutine 7 7 100.0
pod 2 4 50.0
total 29 32 90.6


line stmt bran cond sub pod time code
1             package Sisimai::Reason::SecurityError;
2 23     23   1627 use feature ':5.10';
  23         46  
  23         1543  
3 23     23   111 use strict;
  23         140  
  23         419  
4 23     23   90 use warnings;
  23         55  
  23         9603  
5              
6 1     1 1 5 sub text { 'securityerror' }
7 4     4 0 13 sub description { 'Email rejected due to security violation was detected 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.0.0
14 331     331 1 610 my $class = shift;
15 331   50     742 my $argv1 = shift // return undef;
16              
17 331         457 state $regex = qr{(?>
18             account[ ]not[ ]subscribed[ ]to[ ]ses
19             |authentication[ ](?:
20             credentials invalid
21             |failure
22             |failed;[ ]server[ ][^ ]+[ ]said: # Postfix
23             |required
24             |turned[ ]on[ ]in[ ]your[ ]email[ ]client
25             )
26             |authentification[ ]requise.+[0-9a-z_]+402
27             |codes?[ ]d'?[ ]*authentification[ ]invalide.+[0-9a-z_]+305
28             |domain[ ][^ ]+[ ]is[ ]a[ ]dead[ ]domain
29             |executable[ ]files[ ]are[ ]not[ ]allowed[ ]in[ ]compressed[ ]files
30             |insecure[ ]mail[ ]relay
31             |recipient[ ]address[ ]rejected:[ ]access[ ]denied
32             |sorry,[ ]you[ ]don'?t[ ]authenticate[ ]or[ ]the[ ]domain[ ]isn'?t[ ]in[ ]
33             my[ ]list[ ]of[ ]allowed[ ]rcpthosts
34             |tls[ ]required[ ]but[ ]not[ ]supported # SendGrid:the recipient mailserver does not support TLS or have a valid certificate
35             |unauthenticated[ ]senders[ ]not[ ]allowed
36             |user[ ][^ ]+[ ]is[ ]not[ ]authorized[ ]to[ ]perform[ ]ses:sendrawemail[ ]on[ ]resource
37             |you[ ]are[ ]not[ ]authorized[ ]to[ ]send[ ]mail,[ ]authentication[ ]is[ ]required
38             |verification[ ]failure
39             )
40             }x;
41 331 100       3654 return 1 if $argv1 =~ $regex;
42 320         774 return 0;
43             }
44              
45             sub true {
46             # The bounce reason is security error or not
47             # @param [Sisimai::Data] argvs Object to be detected the reason
48             # @return [Integer] 1: is security error
49             # 0: is not security error
50             # @see http://www.ietf.org/rfc/rfc2822.txt
51 2     2 0 6 return undef;
52             }
53              
54             1;
55             __END__