File Coverage

lib/Sisimai/Rhost/IUA.pm
Criterion Covered Total %
statement 15 15 100.0
branch 1 2 50.0
condition 3 4 75.0
subroutine 4 4 100.0
pod 0 1 0.0
total 23 26 88.4


line stmt bran cond sub pod time code
1             package Sisimai::Rhost::IUA;
2 6     6   1486 use feature ':5.10';
  6         12  
  6         544  
3 6     6   31 use strict;
  6         10  
  6         117  
4 6     6   24 use warnings;
  6         11  
  6         1161  
5              
6             sub get {
7             # Detect bounce reason from https://www.i.ua/
8             # @param [Sisimai::Data] argvs Parsed email object
9             # @return [String] The bounce reason at https://www.i.ua/
10             # @since v4.25.0
11 13     13 0 919 my $class = shift;
12 13   100     48 my $argvs = shift // return undef;
13              
14 12         62 state $errorcodes = {
15             # http://mail.i.ua/err/$(CODE)
16             '1' => 'norelaying', # The use of SMTP as mail gate is forbidden.
17             '2' => 'userunknown', # User is not found.
18             '3' => 'suspend', # Mailbox was not used for more than 3 months
19             '4' => 'mailboxfull', # Mailbox is full.
20             '5' => 'toomanyconn', # Letter sending limit is exceeded.
21             '6' => 'norelaying', # Use SMTP of your provider to send mail.
22             '7' => 'blocked', # Wrong value if command HELO/EHLO parameter.
23             '8' => 'rejected', # Couldn't check sender address.
24             '9' => 'blocked', # IP-address of the sender is blacklisted.
25             '10' => 'filtered', # Not in the list Mail address management.
26             };
27 12         38 my $statusmesg = lc $argvs->diagnosticcode;
28 12 50       148 my $codenumber = $statusmesg =~ m|[.]i[.]ua/err/(\d+)| ? $1 : 0;
29 12   50     67 return $errorcodes->{ $codenumber } || '';
30             }
31              
32             1;
33             __END__