File Coverage

lib/Sisimai/Rhost/MessageLabs.pm
Criterion Covered Total %
statement 20 20 100.0
branch 4 4 100.0
condition 2 2 100.0
subroutine 4 4 100.0
pod 0 1 0.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Sisimai::Rhost::MessageLabs;
2 5     5   1578 use v5.26;
  5         23  
3 5     5   35 use strict;
  5         11  
  5         171  
4 5     5   27 use warnings;
  5         10  
  5         2433  
5              
6             sub find {
7             # Detect bounce reason from Email Security (formerly MessageLabs.com)
8             # @param [Sisimai::Fact] argvs Decoded email object
9             # @return [String] The bounce reason for MessageLabs
10             # @since v5.2.0
11             # @see
12             # - https://www.broadcom.com/products/cybersecurity/email
13             # - https://knowledge.broadcom.com/external/article/169652/email-error-and-bounce-codes-for-email-s.html
14 23     23 0 1081 my $class = shift;
15 23 100 100     88 my $argvs = shift // return ""; return '' unless length $argvs->{'diagnosticcode'};
  22         110  
16              
17 21         98 state $messagesof = {
18             "authfailure" => [
19             # - 553 DMARC domain authentication fail
20             # - https://knowledge.broadcom.com/external/article/175407
21             # An email has failed delivery and the reason provided in Track and Trace is due
22             # to SPF Record. 553-SPF (Sender Policy Framework) domain authentication fail.
23             "domain authentication fail",
24             ],
25             "badreputation" => [
26             # - https://knowledge.broadcom.com/external/article/164955
27             # "501 Connection rejected by policy [7.7]" 20805, please visit www.messagelabs.com/support
28             # for more details about this error message.
29             # My IP has a negative reputation with Symantec. To check the reputation of a
30             # specific IP address, go to https://ipremoval.sms.symantec.com/.
31             # - https://knowledge.broadcom.com/external/article/384503
32             # Users are receiving a non-delivery receipt (NDR) when sending an email to a
33             # Symantec Email Security.cloud customer:
34             "Connection rejected by policy",
35             ],
36             "blocked" => [
37             # - https://knowledge.broadcom.com/external/article/165165
38             # You are sending an email to a domain protected by the Symantec Email Security.Cloud
39             # service and are receiving a non delivery receipt (NDR) stating the email delivery failed.
40             # 553-mail rejected because your IP is in the PBL. See http://www.spamhaus.org/pbl
41             # - Sorry, your IP address has been blocked
42             # * This error message indicates that your public IP address has been put on a
43             # block list by the Spamhaus PBL block list. To resolve this issue, request to
44             # have your IP removed at http://www.spamhaus.org/pbl/.
45             # * The delisting process is normally quicker than an hour. Once an hour has passed
46             # try to resend your email.
47             # * If the problem persists, contact the recipient by other means (e.g. phone)
48             # and request that your email address is added to their Email Security.cloud
49             # approved sender's list.
50             # - Sorry, your email address (addr) has been blocked
51             # * Check with your administrator or ISP that your mail server is not in open relay.
52             # Search “Open Relay Test” for an independent testing tool. If your mail server
53             # is an open relay, please fix the open relay, wait 24 hours, and then try to
54             # resend your email.
55             # * Check with your administrator or ISP that your IP address is not on any spam
56             # block lists. Search “email blacklist check” to check using an independent tool.
57             # If your IP address is on any block lists, please request for removal, wait 24
58             # hours, and then try to resend your email.
59             # If the problem persists, contact the recipient by other means (e.g. phone) for
60             # further assistance.
61             # - Sorry, your IP address (ip-addr) has been blocked
62             "mail rejected because your IP is in the PBL",
63             "your IP address has been ",
64             "your IP address (ip-addr) has been blocked",
65             "your email address (addr) has been blocked",
66             ],
67             "contenterror" => [
68             # - 553 Stray linefeeds in message (#5.6.2)
69             # This error message happens because we strictly enforce the Internet Message Format
70             # standard RFC 5322 (and its predecessor RFC 2822) which state, "CR and LF MUST
71             # only occur together as CRLF; they MUST NOT appear independently in the body.
72             "Stray linefeeds in message",
73             ],
74             "failedstarttls" => [
75             # - https://knowledge.broadcom.com/external/article/162152
76             # You are sending to a domain protected by the Symantec Email Security.cloud
77             # service, or you are a customer subscribed to Symantec Email Security.cloud
78             # sending outbound through the service. The Email Security.cloud server responds
79             # to the SMTP RCPT TO: command with "451 TLS/SSLv3 Connection required. (#4.7.1)".
80             # - 451 TLS/SSLv3 Connection required. (#4.7.1)
81             # - Within the ClientNet portal, the Email Track and Trace tool shows "Not Delivered"
82             # in the Delivered column and "Boundary Encryption" in the "Service" column.
83             "TLS/SSLv3 Connection required",
84             ],
85             "norelaying" => [
86             # - https://knowledge.broadcom.com/external/article/162137
87             # You received a Non-Delivery Report (NDR) for email sent through the Symantec
88             # Email Security.cloud infrastructure, with the message "You are trying to use
89             # me [server-X.tower-x.messagelabs.com] as a relay, but I have not been configured
90             # to let you [IP, address] do this."
91             " as a relay, ",
92             ],
93             "notcompliantrfc" => [
94             # - The format of your message did not comply with RFC 2822.
95             # - Contact your IT administrator or ISP.
96             # - If the problem persists, contact the recipient by other means (e.g. phone).
97             #
98             # - 550 [XX.XX.XX.XX] has detected that this message is not RFC 5322
99             # * Ensure that the message complied to RFC 5322.
100             "550 Requested action aborted [4]",
101             "has detected that this message is not RFC 5322",
102             ],
103             "ratelimited" => [
104             # - https://knowledge.broadcom.com/external/article/385809
105             # Email Security Cloud is attempting to deliver the email and recipient MTA is
106             # responding "452 Too many recipients received this hour".
107             # - https://knowledge.broadcom.com/external/article/164767
108             # This error can occur when sending outbound or inbound emails through Email
109             # Security.Cloud. A non-delivery receipt (NDR) stating delivery contains a message
110             # that the intended recipient has failed with error:
111             # "460 too many messages (#4.3.0)"
112             "Too many recipients received this hour",
113             "too many messages",
114             ],
115             "rejected" => [
116             # - 550 sender envelope domain not allowed for sender IP address (#5.1.8)
117             # This error occurs when a sender attempts to send an email and any one of the
118             # following are true:
119             # * The sending domain has not been registered under My Domains or Third-Party Domains.
120             # * The sending domain is inactive.
121             # * The sending IP is not in Outbound Routes.
122             # - 553 Sorry, your domain has been blocked
123             # The error message indicates that your IP address is on the recipient’s private
124             # block list. Contact the recipient and request that your email address is added
125             # to their Email Security.cloud approved sender's list.
126             # - 553 Sorry, your email address has been blocked
127             # The error message indicates that your domain is on the recipient’s private block
128             # list. Contact the recipient by other means (e.g. phone) and request that your
129             # email address is added to their Email Security.cloud approved senders list.
130             # - https://knowledge.broadcom.com/external/article/162232
131             # You have received an email notification from Symantec Email Security.cloud:
132             # * An individual end user account is either sending spam through Symantec Email
133             # Security.cloud or is receiving a bounceback error message indicating they are
134             # on the "badmailfrom" list.
135             # * The error message received is: "553 sorry, your envelope sender is in my
136             # badmailfrom list. Please visit www.symanteccloud.com/troubleshooting for more
137             # details about this error message and instructions to resolve this issue. (#5.7.1)."
138             # - https://knowledge.broadcom.com/external/article/173082
139             # Emails from a sender are blocked by the Anti-Spam service stating that they are
140             # in your company's blacklist.
141             # * 553-Sorry, your email address has been blacklisted
142             # * 553-Sorry, your domain has been blacklisted
143             # * 553-Sorry, your IP address has been blacklisted
144             "sender envelope domain not allowed for sender IP address",
145             "your domain has been blocked",
146             "your email address has been blocked",
147             "your envelope sender is in my badmailfrom list",
148             "your email address has been blacklisted",
149             "your domain has been blacklisted",
150             ],
151             "securityerror" => ["Please turn on SMTP Authentication in your mail client"],
152             "spamdetected" => [
153             # - https://knowledge.broadcom.com/external/article/173867
154             # Legitimate email, either outbound or inbound, is incorrectly flagged as spam
155             # (false positive) by Email Security.cloud. This email may have the following errors:
156             # * 553 - Message Filtered
157             # * filtered by Outbound scanning.
158             "Message Filtered",
159             "filtered by Outbound scanning",
160             ],
161             "userunknown" => [
162             # - https://knowledge.broadcom.com/external/article/165163
163             # When sending email to a user on the Symantec Email Security.cloud service, the
164             # message is rejected. The sender receives a non-delivery email with a 500 series
165             # error code indicating that the recipient is invalid.
166             # : 550-Invalid recipient 550 (#5.1.1)
167             # - 553 Recipient mailbox is not allowed
168             # The error message indicates that you have sent an email to an invalid address
169             # in the recipient’s domain. Double-check the email address for any spelling errors.
170             # - https://knowledge.broadcom.com/external/article/175710
171             # This error indicates that you have sent an email to an invalid address to the
172             # recipient’s domain. "Recipient mailbox is not allowed"
173             "No such user",
174             "Invalid recipient",
175             "mailbox is not allowed",
176             "Recipient mailbox is not allowed",
177             ],
178             };
179 21         60 my $issuedcode = $argvs->{'diagnosticcode'};
180 21         50 my $reasontext = '';
181              
182 21         158 for my $e ( keys %$messagesof ) {
183             # Try to find the error message matches with the given error message string
184 219 100       379 next unless grep { index($issuedcode, $_) > -1 } $messagesof->{ $e }->@*;
  476         1107  
185 13         28 $reasontext = $e;
186 13         29 last;
187             }
188 21         107 return $reasontext;
189             }
190              
191             1;
192             __END__