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 26     26   2009 use feature ':5.10';
  26         224  
  26         1836  
3 26     26   335 use strict;
  26         58  
  26         586  
4 26     26   131 use warnings;
  26         50  
  26         12542  
5              
6 1     1 1 22 sub text { 'securityerror' }
7 4     4 0 16 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 391     391 1 749 my $class = shift;
15 391   50     1040 my $argv1 = shift // return undef;
16              
17 391         692 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 391 100       4928 return 1 if $argv1 =~ $regex;
42 380         1110 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 7 return undef;
52             }
53              
54             1;
55             __END__