File Coverage

lib/Sisimai/Rhost/FrancePTT.pm
Criterion Covered Total %
statement 19 19 100.0
branch 3 4 75.0
condition 4 4 100.0
subroutine 4 4 100.0
pod 0 1 0.0
total 30 32 93.7


line stmt bran cond sub pod time code
1             package Sisimai::Rhost::FrancePTT;
2 8     8   1648 use feature ':5.10';
  8         40  
  8         864  
3 8     8   59 use strict;
  8         24  
  8         231  
4 8     8   46 use warnings;
  8         26  
  8         3057  
5              
6             sub get {
7             # Detect bounce reason from Orange and La Poste
8             # @param [Sisimai::Data] argvs Parsed email object
9             # @return [String] The bounce reason for Orange, La Poste
10 88     88 0 1131 my $class = shift;
11 88   100     273 my $argvs = shift // return undef;
12 87 50       263 return $argvs->reason if $argvs->reason;
13              
14 87         1829 state $errorcodes = {
15             # 550 5.7.1 Service unavailable; client [X.X.X.X] blocked using Spamhaus
16             # Les emails envoyes vers la messagerie Laposte.net ont ete bloques par nos services.
17             # Afin de regulariser votre situation, nous vous invitons a cliquer sur le lien ci-dessous et a suivre la procedure.
18             # The emails sent to the mail host Laposte.net were blocked by our services.
19             # To regularize your situation please click on the link below and follow the procedure
20             # https://www.spamhaus.org/lookup/ LPNAAA_101 (in reply to RCPT TO command))
21             '101' => 'blocked',
22              
23             # 550 mwinf5c04 ME Adresse IP source bloquee pour incident de spam.
24             # Client host blocked for spamming issues. OFR006_102 Ref
25             #
26             # refused to talk to me: 550 5.5.0 Les emails envoyes vers la messagerie Laposte.net ont ete bloques par nos services.
27             # Afin de regulariser votre situation, nous vous invitons a cliquer sur le lien ci-dessous et a suivre la procedure.
28             # The emails sent to the mail host Laposte.net were blocked by our services.
29             # To regularize your situation please click on the link below and follow the procedure
30             # https://senderscore.org/blacklistlookup/ LPN007_102
31             '102' => 'blocked',
32              
33             # refused to talk to me: 550 mwinf5c10 ME Service refuse. Veuillez essayer plus tard.
34             # Service refused, please try later. OFR006_103 X.X.X.X [103]
35             '103' => 'blocked',
36              
37             # refused to talk to me: 421 mwinf5c79 ME Trop de connexions, veuillez verifier votre configuration.
38             # Too many connections, slow down. OFR005_104 [104]
39             # Too many connections, slow down. LPN105_104
40             '104' => 'toomanyconn',
41              
42             # Veuillez essayer plus tard.
43             '105' => undef,
44              
45             # refused to talk to me: 421 4.2.1 Service refuse. Veuillez essayer plus tard.
46             # Service refused, please try later. LPN006_107)
47             '107' => undef,
48              
49             # refused to talk to me: 550 5.5.0 Service refuse. Veuillez essayer plus tard.
50             # service refused, please try later. LPN001_108
51             '108' => undef,
52              
53             # Veuillez essayer plus tard. LPN003_109
54             '109' => undef,
55              
56             # Veuillez essayer plus tard. OFR004_201
57             '201' => undef,
58              
59             # 550 5.7.0 Code d'authentification invalide OFR_305
60             '305' => 'securityerror',
61              
62             # 550 5.5.0 SPF: *** is not allowed to send mail. LPN004_401
63             '401' => 'blocked',
64              
65             # 550 5.5.0 Authentification requise. Authentication Required. LPN105_402
66             '402' => 'securityerror',
67              
68             # 5.0.1 Emetteur invalide. Invalid Sender.
69             '403' => 'rejected',
70              
71             # 5.0.1 Emetteur invalide. Invalid Sender. LPN105_405
72             # 501 5.1.0 Emetteur invalide. Invalid Sender. OFR004_405 [405] (in reply to MAIL FROM command))
73             '405' => 'rejected',
74              
75             # Emetteur invalide. Invalid Sender. OFR_415
76             '415' => 'rejected',
77              
78             # 550 5.1.1 Adresse d au moins un destinataire invalide.
79             # Invalid recipient. LPN416 (in reply to RCPT TO command)
80             # Invalid recipient. OFR_416 [416] (in reply to RCPT TO command)
81             '416' => 'userunknown',
82              
83             # 552 5.1.1 Boite du destinataire pleine.
84             # Recipient overquota. OFR_417 [417] (in reply to RCPT TO command))
85             '417' => 'mailboxfull',
86              
87             # Adresse d au moins un destinataire invalide
88             '418' => 'userunknown',
89              
90             # 550 5.5.0 Boite du destinataire archivee.
91             # Archived recipient. LPN007_420 (in reply to RCPT TO command)
92             '420' => 'suspend',
93              
94             # 5.5.3 Mail from not owned by user. LPN105_421.
95             '421' => 'rejected',
96              
97             # Service refused, please try later. LPN105_423
98             '423' => undef,
99              
100             # Veuillez essayer plus tard. LPN105_424
101             '424' => undef,
102              
103             # 550 5.5.0 Le compte du destinataire est bloque. The recipient account isblocked. LPN007_426 (in reply to RCPT TO command)
104             '426' => 'suspend',
105              
106             # 421 4.2.0 Service refuse. Veuillez essayer plus tard.
107             # Service refused, please try later. OFR005_505 [505] (in reply to end of DATA command)
108             #
109             # 421 4.2.1 Service refuse. Veuillez essayer plus tard.
110             # Service refused, please try later. LPN007_505 (in reply to end of DATA command)
111             '505' => 'systemerror',
112              
113             # Mail rejete. Mail rejected. OFR_506 [506]
114             '506' => 'spamdetected',
115              
116             # 550 5.5.0 Service refuse. Veuillez essayer plus tard.
117             # service refused, please try later. LPN005_510 (in reply to end of DATA command)
118             '510' => 'blocked',
119              
120             # Mail rejete. Mail rejected. OUK_513
121             '513' => undef,
122              
123             # Taille limite du message atteinte
124             '514' => 'mesgtoobig',
125              
126             # 571 5.7.1 Message refused, DMARC verification Failed.
127             # Message refuse, verification DMARC en echec LPN007_517
128             '517' => 'policyviolation',
129              
130             # 554 5.7.1 Client host rejected
131             # LPN000_630
132             '630' => 'policyviolation',
133              
134             # 421 mwinf5c77 ME Service refuse. Veuillez essayer plus tard.
135             # Service refused, please try later. OFR_999 [999]
136             '999' => 'blocked',
137             };
138              
139 87         265 my $statusmesg = $argvs->diagnosticcode;
140 87         378 my $reasontext = '';
141              
142 87 100       1485 if( $statusmesg =~ /\b(LPN|LPNAAA|OFR|OUK)(_[0-9]{3}|[0-9]{3}[-_][0-9]{3})\b/i ) {
143             # OUK_513, LPN105-104, OFR102-104, ofr_506
144 82         795 my $v = sprintf("%03d", substr($1.$2, -3, 3));
145 82   100     505 $reasontext = $errorcodes->{ $v } || 'undefined';
146             }
147 87         269 return $reasontext;
148             }
149              
150             1;
151             __END__