File Coverage

lib/Sisimai/Reason/MailboxFull.pm
Criterion Covered Total %
statement 24 24 100.0
branch 9 10 90.0
condition 5 6 83.3
subroutine 7 7 100.0
pod 2 4 50.0
total 47 51 92.1


line stmt bran cond sub pod time code
1             package Sisimai::Reason::MailboxFull;
2 59     59   1245 use feature ':5.10';
  59         177  
  59         5889  
3 59     59   422 use strict;
  59         97  
  59         1320  
4 59     59   365 use warnings;
  59         100  
  59         19563  
5              
6 164     164 1 1027 sub text { 'mailboxfull' }
7 4     4 0 16 sub description { "Email rejected due to a recipient's mailbox is full" }
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 2436     2436 1 9006 my $class = shift;
15 2436   50     4947 my $argv1 = shift // return undef;
16              
17 2436         4267 state $index = [
18             'account disabled temporarly for exceeding receiving limits',
19             'account is exceeding their quota',
20             'account is over quota',
21             'account is temporarily over quota',
22             'boite du destinataire pleine',
23             'delivery failed: over quota',
24             'disc quota exceeded',
25             'does not have enough space',
26             'exceeded storage allocation',
27             'exceeding its mailbox quota',
28             'full mailbox',
29             'is over disk quota',
30             'is over quota temporarily',
31             'mail file size exceeds the maximum size allowed for mail delivery',
32             'mail quota exceeded',
33             'mailbox exceeded the local limit',
34             'mailbox full',
35             'mailbox has exceeded its disk space limit',
36             'mailbox is full',
37             'mailbox over quota',
38             'mailbox quota usage exceeded',
39             'mailbox size limit exceeded',
40             'maildir over quota',
41             'maildir delivery failed: userdisk quota ',
42             'maildir delivery failed: domaindisk quota ',
43             'mailfolder is full',
44             'not enough storage space in',
45             'over the allowed quota',
46             'quota exceeded',
47             'quota violation for',
48             'recipient reached disk quota',
49             'recipient rejected: mailbox would exceed maximum allowed storage',
50             'the recipient mailbox has exceeded its disk space limit',
51             "the user's space has been used up",
52             'the user you are trying to reach is over quota',
53             'too much mail data', # @docomo.ne.jp
54             'user has exceeded quota, bouncing mail',
55             'user has too many messages on the server',
56             'user is over quota',
57             'user is over the quota',
58             'user over quota',
59             'user over quota. (#5.1.1)', # qmail-toaster
60             'was automatically rejected: quota exceeded',
61             'would be over the allowed quota',
62             ];
63 2436 100       4877 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  107184         159382  
64 2376         6666 return 0;
65             }
66              
67             sub true {
68             # The envelope recipient's mailbox is full or not
69             # @param [Sisimai::Data] argvs Object to be detected the reason
70             # @return [Integer] 1: is mailbox full
71             # 0: is not mailbox full
72             # @since v4.0.0
73             # @see http://www.ietf.org/rfc/rfc2822.txt
74 1982     1982 0 3454 my $class = shift;
75 1982   100     4353 my $argvs = shift // return undef;
76              
77 1981 100       5444 return undef unless $argvs->deliverystatus;
78 1581 50       8547 return 1 if $argvs->reason eq 'mailboxfull';
79              
80             # Delivery status code points "mailboxfull".
81             # Status: 4.2.2
82             # Diagnostic-Code: SMTP; 450 4.2.2 <***@example.jp>... Mailbox Full
83 1581 100 100     8571 return 1 if (Sisimai::SMTP::Status->name($argvs->deliverystatus) || '') eq 'mailboxfull';
84              
85             # Check the value of Diagnosic-Code: header with patterns
86 1446 100       4011 return 1 if __PACKAGE__->match(lc $argvs->diagnosticcode);
87 1436         4721 return 0;
88             }
89              
90             1;
91             __END__