1package Sisimai::Rhost::GoDaddy; 2use feature ':5.10'; 3use strict; 4use warnings; 5 6# https://www.godaddy.com/help/what-does-my-email-bounceback-mean-3568 7sub get { 8 # Detect bounce reason from GoDaddy (smtp.secureserver.net) 9 # @param [Sisimai::Data] argvs Parsed email object 10 # @return [String] The bounce reason for GoDaddy 11 # @see https://www.godaddy.com/help/what-does-my-email-bounceback-mean-3568 12 my $class = shift; 13 my $argvs = shift // return undef; 14 return $argvs->reason if $argvs->reason; 15 16 state $errorcodes = { 17 'IB103' => 'blocked', # 554 Connection refused. This IP has a poor reputation on Cloudmark Sender Intelligence (CSI). IB103 18 'IB104' => 'blocked', # 554 Connection refused. This IP is listed on the Spamhaus Block List (SBL). IB104 19 'IB105' => 'blocked', # 554 Connection refused. This IP is listed on the Exploits Block List (XBL). IB105 20 'IB106' => 'blocked', # 554 Connection refused. This IP is listed on the Policy Block List (PBL). IB106 21 'IB007' => 'toomanyconn', # 421 Connection refused, too many sessions from This IP. Please lower the number of concurrent sessions. IB007 22 'IB101' => 'expired', # 421 Server temporarily unavailable. Try again later. IB101 23 'IB108' => 'blocked', # 421 Temporarily rejected. Reverse DNS for this IP failed. IB108 24 'IB110' => 'blocked', # 554 This IP has been temporarily blocked for attempting to send too many messages containing content judged to be spam by the Internet community. IB110 25 'IB111' => 'blocked', # 554 This IP has been blocked for the day, for attempting to send too many messages containing content judged to be spam by the Internet community. IB111 26 'IB112' => 'blocked', # 554 This IP has been temporarily blocked for attempting to mail too many invalid recipients. IB112 27 'IB113' => 'blocked', # 554 This IP has been blocked for the day, for attempting to mail too many invalid recipients. IB113 28 'IB212' => 'spamdetected', # 552 This message has been rejected due to content judged to be spam by the Internet community. IB212 29 'IB401' => 'securityerror', # 535 Authentication not allowed on IBSMTP Servers. IB401 30 'IB501' => 'rejected', # 550 holly@coolexample.com Blank From: addresses are not allowed. Please provide a valid From. IB501 31 'IB502' => 'rejected', # 550 holly@coolexample.com IP addresses are not allowed as a From: Address. Please provide a valid From. IB502 32 'IB504' => 'toomanyconn', # 550 This IP has sent too many messages this hour. IB504 33 'IB506' => 'rejected', # 550 coolexample.com From: Domain is invalid. Please provide a valid From: IB506 34 'IB508' => 'rejected', # 550 holly@coolexample.com Invalid SPF record. Please inspect your SPF settings, and try again. IB508 35 'IB510' => 'toomanyconn', # 550 This message has exceeded the max number of messages per session. Please open a new session and try again. IB510 36 'IB607' => 'toomanyconn', # 550 This IP has sent too many to too many recipients this hour. IB607 37 'IB705' => 'virusdetected', # 552 Virus infected message rejected. IB705 38 39 }; 40 state $messagesof = { 41 'blocked' => ['www.spamhaus.org/query/bl?ip=', '554 RBL Reject.'], 42 'expired' => ['Delivery timeout', "451 Sorry, I wasn't able to establish an SMTP connection."], 43 'suspend' => ['Account disabled'], 44 'mailboxfull' => ['Account storage limit'], 45 'userunknown' => ['Account does not exist', '550 Recipient not found.'], 46 }; 47 48 my $statusmesg = $argvs->diagnosticcode; 49 my $reasontext = ''; 50 51 if( $statusmesg =~ /\s(IB\d{3})\b/ ) { 52 # 192.0.2.22 has sent to too many recipients this hour. IB607 ... 53 $reasontext = $errorcodes->{ $1 }; 54 } else { 55 # 553 http://www.spamhaus.org/query/bl?ip=192.0.0.222 56 for my $e ( keys %$messagesof ) { 57 for my $f ( @{ $messagesof->{ $e } } ) { 58 next if index($statusmesg, $f) == -1; 59 $reasontext = $e; 60 last 61 } 62 last if $reasontext; 63 } 64 } 65 return $reasontext; 66} 67 681; 69__END__ 70 71=encoding utf-8 72 73=head1 NAME 74 75Sisimai::Rhost::GoDaddy - Detect the bounce reason returned from GoDaddy. 76 77=head1 SYNOPSIS 78 79 use Sisimai::Rhost; 80 81=head1 DESCRIPTION 82 83Sisimai::Rhost detects the bounce reason from the content of Sisimai::Data 84object as an argument of get() method when the value of C<rhost> of the object 85end with "secureserver.net". This class is called only Sisimai::Data class. 86 87=head1 CLASS METHODS 88 89=head2 C<B<get(I<Sisimai::Data Object>)>> 90 91C<get()> detects the bounce reason. 92 93=head1 AUTHOR 94 95azumakuniyuki 96 97=head1 COPYRIGHT 98 99Copyright (C) 2017-2018,2020 azumakuniyuki, All rights reserved. 100 101=head1 LICENSE 102 103This software is distributed under The BSD 2-Clause License. 104 105=cut 106 107