sisimai 4.25.16-java → 5.0.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/rake-test.yml +55 -0
  3. data/.travis.yml +3 -3
  4. data/ANALYTICAL-PRECISION +2 -2
  5. data/Benchmarks.mk +3 -3
  6. data/CONTRIBUTING +1 -1
  7. data/ChangeLog.md +451 -393
  8. data/Developers.mk +5 -6
  9. data/Gemfile +1 -1
  10. data/Makefile +15 -15
  11. data/README-JA.md +323 -149
  12. data/README.md +319 -149
  13. data/Rakefile +9 -3
  14. data/Repository.mk +2 -3
  15. data/lib/sisimai/address.rb +118 -74
  16. data/lib/sisimai/arf.rb +84 -82
  17. data/lib/sisimai/datetime.rb +5 -52
  18. data/lib/sisimai/{data → fact}/json.rb +7 -9
  19. data/lib/sisimai/fact/yaml.rb +31 -0
  20. data/lib/sisimai/fact.rb +506 -0
  21. data/lib/sisimai/lhost/activehunter.rb +12 -14
  22. data/lib/sisimai/lhost/amavis.rb +11 -14
  23. data/lib/sisimai/lhost/amazonses.rb +37 -42
  24. data/lib/sisimai/lhost/amazonworkmail.rb +15 -19
  25. data/lib/sisimai/lhost/aol.rb +12 -15
  26. data/lib/sisimai/lhost/apachejames.rb +19 -21
  27. data/lib/sisimai/lhost/barracuda.rb +10 -12
  28. data/lib/sisimai/lhost/bigfoot.rb +21 -22
  29. data/lib/sisimai/lhost/biglobe.rb +15 -16
  30. data/lib/sisimai/lhost/courier.rb +20 -20
  31. data/lib/sisimai/lhost/domino.rb +23 -20
  32. data/lib/sisimai/lhost/einsundeins.rb +23 -18
  33. data/lib/sisimai/lhost/exchange2003.rb +30 -29
  34. data/lib/sisimai/lhost/exchange2007.rb +70 -58
  35. data/lib/sisimai/lhost/exim.rb +179 -174
  36. data/lib/sisimai/lhost/ezweb.rb +31 -56
  37. data/lib/sisimai/lhost/facebook.rb +21 -34
  38. data/lib/sisimai/lhost/fml.rb +43 -48
  39. data/lib/sisimai/lhost/gmail.rb +29 -29
  40. data/lib/sisimai/lhost/gmx.rb +18 -17
  41. data/lib/sisimai/lhost/googlegroups.rb +11 -11
  42. data/lib/sisimai/lhost/gsuite.rb +21 -28
  43. data/lib/sisimai/lhost/imailserver.rb +25 -39
  44. data/lib/sisimai/lhost/interscanmss.rb +28 -31
  45. data/lib/sisimai/lhost/kddi.rb +22 -28
  46. data/lib/sisimai/lhost/mailfoundry.rb +11 -12
  47. data/lib/sisimai/lhost/mailmarshalsmtp.rb +25 -29
  48. data/lib/sisimai/lhost/mailru.rb +37 -40
  49. data/lib/sisimai/lhost/mcafee.rb +21 -31
  50. data/lib/sisimai/lhost/messagelabs.rb +17 -21
  51. data/lib/sisimai/lhost/messagingserver.rb +40 -37
  52. data/lib/sisimai/lhost/mfilter.rb +16 -17
  53. data/lib/sisimai/lhost/mxlogic.rb +24 -33
  54. data/lib/sisimai/lhost/notes.rb +17 -17
  55. data/lib/sisimai/lhost/office365.rb +64 -28
  56. data/lib/sisimai/lhost/opensmtpd.rb +12 -13
  57. data/lib/sisimai/lhost/outlook.rb +12 -16
  58. data/lib/sisimai/lhost/postfix.rb +179 -130
  59. data/lib/sisimai/lhost/powermta.rb +12 -14
  60. data/lib/sisimai/lhost/qmail.rb +44 -47
  61. data/lib/sisimai/lhost/receivingses.rb +15 -21
  62. data/lib/sisimai/lhost/sendgrid.rb +34 -34
  63. data/lib/sisimai/lhost/sendmail.rb +65 -53
  64. data/lib/sisimai/lhost/surfcontrol.rb +19 -19
  65. data/lib/sisimai/lhost/v5sendmail.rb +45 -39
  66. data/lib/sisimai/lhost/verizon.rb +35 -39
  67. data/lib/sisimai/lhost/x1.rb +18 -17
  68. data/lib/sisimai/lhost/x2.rb +17 -14
  69. data/lib/sisimai/lhost/x3.rb +19 -19
  70. data/lib/sisimai/lhost/x4.rb +72 -57
  71. data/lib/sisimai/lhost/x5.rb +17 -19
  72. data/lib/sisimai/lhost/x6.rb +41 -17
  73. data/lib/sisimai/lhost/yahoo.rb +17 -16
  74. data/lib/sisimai/lhost/yandex.rb +16 -21
  75. data/lib/sisimai/lhost/zoho.rb +16 -15
  76. data/lib/sisimai/lhost.rb +8 -10
  77. data/lib/sisimai/mail/maildir.rb +1 -3
  78. data/lib/sisimai/mail/mbox.rb +3 -4
  79. data/lib/sisimai/mail/memory.rb +0 -1
  80. data/lib/sisimai/mail/stdin.rb +1 -3
  81. data/lib/sisimai/mail.rb +3 -7
  82. data/lib/sisimai/mda.rb +28 -42
  83. data/lib/sisimai/message.rb +444 -326
  84. data/lib/sisimai/order.rb +5 -5
  85. data/lib/sisimai/reason/authfailure.rb +65 -0
  86. data/lib/sisimai/reason/badreputation.rb +53 -0
  87. data/lib/sisimai/reason/blocked.rb +96 -160
  88. data/lib/sisimai/reason/contenterror.rb +8 -9
  89. data/lib/sisimai/reason/delivered.rb +4 -6
  90. data/lib/sisimai/reason/exceedlimit.rb +10 -12
  91. data/lib/sisimai/reason/expired.rb +7 -8
  92. data/lib/sisimai/reason/feedback.rb +2 -3
  93. data/lib/sisimai/reason/filtered.rb +17 -19
  94. data/lib/sisimai/reason/hasmoved.rb +9 -10
  95. data/lib/sisimai/reason/hostunknown.rb +15 -15
  96. data/lib/sisimai/reason/mailboxfull.rb +11 -12
  97. data/lib/sisimai/reason/mailererror.rb +18 -20
  98. data/lib/sisimai/reason/mesgtoobig.rb +9 -11
  99. data/lib/sisimai/reason/networkerror.rb +5 -8
  100. data/lib/sisimai/reason/norelaying.rb +8 -11
  101. data/lib/sisimai/reason/notaccept.rb +13 -14
  102. data/lib/sisimai/reason/notcompliantrfc.rb +43 -0
  103. data/lib/sisimai/reason/onhold.rb +6 -9
  104. data/lib/sisimai/reason/policyviolation.rb +14 -12
  105. data/lib/sisimai/reason/rejected.rb +26 -24
  106. data/lib/sisimai/reason/requireptr.rb +69 -0
  107. data/lib/sisimai/reason/securityerror.rb +34 -36
  108. data/lib/sisimai/reason/spamdetected.rb +115 -147
  109. data/lib/sisimai/reason/speeding.rb +49 -0
  110. data/lib/sisimai/reason/suspend.rb +12 -11
  111. data/lib/sisimai/reason/syntaxerror.rb +11 -10
  112. data/lib/sisimai/reason/systemerror.rb +7 -9
  113. data/lib/sisimai/reason/systemfull.rb +7 -8
  114. data/lib/sisimai/reason/toomanyconn.rb +9 -11
  115. data/lib/sisimai/reason/undefined.rb +2 -3
  116. data/lib/sisimai/reason/userunknown.rb +129 -146
  117. data/lib/sisimai/reason/vacation.rb +3 -4
  118. data/lib/sisimai/reason/virusdetected.rb +10 -11
  119. data/lib/sisimai/reason.rb +59 -64
  120. data/lib/sisimai/rfc1894.rb +55 -28
  121. data/lib/sisimai/rfc2045.rb +373 -0
  122. data/lib/sisimai/rfc3464.rb +250 -308
  123. data/lib/sisimai/rfc3834.rb +42 -45
  124. data/lib/sisimai/rfc5322.rb +177 -146
  125. data/lib/sisimai/rfc5965.rb +31 -0
  126. data/lib/sisimai/rhost/cox.rb +5 -6
  127. data/lib/sisimai/rhost/franceptt.rb +6 -8
  128. data/lib/sisimai/rhost/godaddy.rb +12 -12
  129. data/lib/sisimai/rhost/google.rb +530 -0
  130. data/lib/sisimai/rhost/iua.rb +9 -10
  131. data/lib/sisimai/rhost/kddi.rb +6 -8
  132. data/lib/sisimai/rhost/{exchangeonline.rb → microsoft.rb} +115 -114
  133. data/lib/sisimai/rhost/mimecast.rb +51 -42
  134. data/lib/sisimai/rhost/nttdocomo.rb +12 -12
  135. data/lib/sisimai/rhost/spectrum.rb +10 -12
  136. data/lib/sisimai/rhost/{tencentqq.rb → tencent.rb} +7 -8
  137. data/lib/sisimai/rhost.rb +23 -31
  138. data/lib/sisimai/smtp/command.rb +59 -0
  139. data/lib/sisimai/smtp/error.rb +4 -7
  140. data/lib/sisimai/smtp/reply.rb +161 -74
  141. data/lib/sisimai/smtp/status.rb +507 -393
  142. data/lib/sisimai/smtp/transcript.rb +124 -0
  143. data/lib/sisimai/smtp.rb +0 -1
  144. data/lib/sisimai/string.rb +74 -5
  145. data/lib/sisimai/time.rb +1 -2
  146. data/lib/sisimai/version.rb +1 -1
  147. data/lib/sisimai.rb +46 -31
  148. data/set-of-emails/maildir/bsd/lhost-domino-02.eml +6 -3
  149. data/set-of-emails/maildir/bsd/lhost-googlegroups-15.eml +174 -0
  150. data/set-of-emails/maildir/bsd/lhost-gsuite-15.eml +229 -0
  151. data/set-of-emails/maildir/bsd/lhost-postfix-75.eml +51 -0
  152. data/set-of-emails/maildir/bsd/lhost-postfix-76.eml +101 -0
  153. data/set-of-emails/maildir/bsd/lhost-postfix-77.eml +74 -0
  154. data/set-of-emails/maildir/bsd/lhost-postfix-78.eml +91 -0
  155. data/set-of-emails/maildir/bsd/lhost-receivingses-08.eml +88 -0
  156. data/set-of-emails/maildir/bsd/lhost-sendmail-60.eml +85 -0
  157. data/set-of-emails/maildir/bsd/rfc3464-43.eml +88 -0
  158. data/set-of-emails/maildir/bsd/rhost-google-03.eml +101 -0
  159. data/set-of-emails/maildir/bsd/rhost-google-04.eml +102 -0
  160. data/set-of-emails/maildir/bsd/rhost-google-05.eml +82 -0
  161. data/set-of-emails/maildir/bsd/rhost-google-06.eml +102 -0
  162. data/set-of-emails/maildir/bsd/rhost-google-07.eml +69 -0
  163. data/set-of-emails/maildir/bsd/rhost-google-08.eml +99 -0
  164. data/sisimai-java.gemspec +1 -1
  165. data/sisimai.gemspec +1 -1
  166. metadata +48 -26
  167. data/.rspec +0 -2
  168. data/lib/sisimai/data/yaml.rb +0 -33
  169. data/lib/sisimai/data.rb +0 -411
  170. data/lib/sisimai/mime.rb +0 -456
  171. data/lib/sisimai/rhost/googleapps.rb +0 -261
  172. /data/set-of-emails/maildir/bsd/{rfc3464-41.eml → rfc3834-05.eml} +0 -0
  173. /data/set-of-emails/maildir/bsd/{rhost-googleapps-01.eml → rhost-google-01.eml} +0 -0
  174. /data/set-of-emails/maildir/bsd/{rhost-googleapps-02.eml → rhost-google-02.eml} +0 -0
  175. /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-01.eml → rhost-microsoft-01.eml} +0 -0
  176. /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-02.eml → rhost-microsoft-02.eml} +0 -0
  177. /data/set-of-emails/maildir/bsd/{rhost-exchangeonline-03.eml → rhost-microsoft-03.eml} +0 -0
  178. /data/set-of-emails/maildir/bsd/{rhost-tencentqq-01.eml → rhost-tencent-01.eml} +0 -0
  179. /data/set-of-emails/maildir/bsd/{rhost-tencentqq-02.eml → rhost-tencent-02.eml} +0 -0
  180. /data/set-of-emails/maildir/bsd/{rhost-tencentqq-03.eml → rhost-tencent-03.eml} +0 -0
@@ -1,14 +1,13 @@
1
1
  module Sisimai
2
2
  module Rhost
3
- # Sisimai::Rhost detects the bounce reason from the content of Sisimai::Data
4
- # object as an argument of get() method when the value of "rhost" of the object
5
- # is "*.secureserver.net". This class is called only Sisimai::Data class.
3
+ # Sisimai::Rhost detects the bounce reason from the content of Sisimai::Fact object as an argument
4
+ # of get() method when the value of "rhost" of the object is "*.secureserver.net". This class is
5
+ # called only Sisimai::Fact class.
6
6
  module GoDaddy
7
7
  class << self
8
- # Imported from p5-Sisimail/lib/Sisimai/Rhost/GoDaddy.pm
9
8
  # https://www.godaddy.com/help/what-does-my-email-bounceback-mean-3568
10
9
  ErrorCodes = {
11
- 'IB103' => 'blocked', # 554 Connection refused. This IP has a poor reputation on Cloudmark Sender Intelligence (CSI). IB103
10
+ 'IB103' => 'badreputation', # 554 Connection refused. This IP has a poor reputation on Cloudmark Sender Intelligence (CSI). IB103
12
11
  'IB104' => 'blocked', # 554 Connection refused. This IP is listed on the Spamhaus Block List (SBL). IB104
13
12
  'IB105' => 'blocked', # 554 Connection refused. This IP is listed on the Exploits Block List (XBL). IB105
14
13
  'IB106' => 'blocked', # 554 Connection refused. This IP is listed on the Policy Block List (PBL). IB106
@@ -39,19 +38,19 @@ module Sisimai
39
38
  }.freeze
40
39
 
41
40
  # Detect bounce reason from GoDaddy
42
- # @param [Sisimai::Data] argvs Parsed email object
41
+ # @param [Sisimai::Fact] argvs Parsed email object
43
42
  # @return [String] The bounce reason for GoDaddy
44
43
  # @see https://www.godaddy.com/help/what-does-my-email-bounceback-mean-3568
45
44
  def get(argvs)
46
- return argvs.reason unless argvs.reason.empty?
45
+ return argvs['reason'] unless argvs['reason'].empty?
47
46
 
48
- statusmesg = argvs.diagnosticcode
47
+ statusmesg = argvs['diagnosticcode']
48
+ positionib = statusmesg.index(' IB') || -1
49
49
  reasontext = ''
50
50
 
51
- if cv = statusmesg.match(/\s(IB\d{3})\b/)
52
- # 192.0.2.22 has sent to too many recipients this hour. IB607 ...
53
- reasontext = ErrorCodes[cv[1]]
54
- else
51
+ # 192.0.2.22 has sent to too many recipients this hour. IB607 ...
52
+ reasontext = ErrorCodes[statusmesg[positionib + 1, 5]] || '' if positionib > 1
53
+ if reasontext.empty?
55
54
  # 553 http://www.spamhaus.org/query/bl?ip=192.0.0.222
56
55
  MessagesOf.each_key do |e|
57
56
  MessagesOf[e].each do |f|
@@ -62,6 +61,7 @@ module Sisimai
62
61
  break unless reasontext.empty?
63
62
  end
64
63
  end
64
+
65
65
  return reasontext
66
66
  end
67
67
 
@@ -0,0 +1,530 @@
1
+ module Sisimai
2
+ module Rhost
3
+ # Sisimai::Rhost detects the bounce reason from the content of Sisimai::Fact object as an argument
4
+ # of get() method when the value of "rhost" of the object is "aspmx.l.google.com". This class is
5
+ # called only Sisimai::Fact class.
6
+ module Google
7
+ class << self
8
+ MessagesOf = {
9
+ 'authfailure' => [
10
+ # - 451 4.7.24 The SPF record of the sending domain has one or more suspicious entries.
11
+ # To protect our users from spam, mail sent from your IP address has been temporarily
12
+ # rate limited. For more information, go to Email sender guidelines.
13
+ # https://support.google.com/mail/answer/81126#authentication
14
+ #
15
+ # - 550 5.7.24 The SPF record of the sending domain has one or more suspicious entries.
16
+ # For more information, go to Email sender guidelines.
17
+ # - https://support.google.com/mail/answer/81126#authentication
18
+ ['451', '4.7.24', 'the spf record of the sending domain has one or more suspicious entries'],
19
+ ['550', '5.7.24', 'the spf record of the sending domain has one or more suspicious entries'],
20
+
21
+ # - 421 4.7.26 This mail has been rate limited because it is unauthenticated.
22
+ # Gmail requires all senders to authenticate with either SPF or DKIM.
23
+ # Authentication results: DKIM = did not pass SPF domain-name with ip: ip-address =
24
+ # did not pass. To resolve this issue, go to Email sender guidelines.
25
+ # - https://support.google.com/mail/answer/81126#authentication
26
+ ['421', '4.7.26', 'gmail requires all senders to authenticate with either spf or dkim'],
27
+ ['550', '5.7.26', 'gmail requires all senders to authenticate with either spf or dkim'],
28
+
29
+ # - 550 5.7.26 This message fails to pass SPF checks for an SPF record with a hard fail
30
+ # policy (-all). To best protect our users from spam and phishing, the message has
31
+ # been blocked. Please visit https://support.google.com/mail/answer/81126 for more
32
+ # information.
33
+ #
34
+ # - 550 5.7.26 The MAIL FROM domain [domain-name] has an SPF record with a hard fail
35
+ # policy (-all) but it fails to pass SPF checks with the ip: [ip-address]. To best
36
+ # protect our users from spam and phishing, the message has been blocked. For more
37
+ # information, go to Email sender guidelines.
38
+ # - https://support.google.com/mail/answer/81126#authentication
39
+ ['550', '5.7.26', 'this message fails to pass spf checks for an spf record with a hard fail'],
40
+ ['550', '5.7.26', 'has an spf record with a hard fail policy'],
41
+
42
+ # - 451 4.7.26 Unauthenticated email from domain-name is not accepted due to domain's
43
+ # DMARC policy, but temporary DNS failures prevent authentication. Please contact the
44
+ # administrator of domain-name domain if this was a legitimate mail. To learn about
45
+ # the DMARC initiative, go to https://support.google.com/mail/?p=DmarcRejection
46
+ ['451', '4.7.26', "is not accepted due to domain's dmarc policy"],
47
+ ['550', '5.7.26', "is not accepted due to domain's dmarc policy"],
48
+
49
+ # - 550 5.7.26 Unauthenticated email from domain-name is not accepted due to domain's
50
+ # DMARC policy. Please contact the administrator of domain-name domain. If this was
51
+ # a legitimate mail please visit [Control unauthenticated mail from your domain] to
52
+ # learn about the DMARC initiative. If the messages are valid and aren't spam, con-
53
+ # tact the administrator of the receiving mail server to determine why your outgoing
54
+ # messages don't pass authentication checks.
55
+ ['550', '5.7.26', "is not accepted due to domain's dmarc policy"],
56
+
57
+ # - 550 5.7.26 This message does not have authentication information or fails to pass
58
+ # authentication checks (SPF or DKIM). To best protect our users from spam, the mes-
59
+ # sage has been blocked. Please visit https://support.google.com/mail/answer/81126
60
+ # for more information.
61
+ ['550', '5.7.1', 'fails to pass authentication checks'],
62
+ ['550', '5.7.26', 'fails to pass authentication checks'],
63
+
64
+ # - 421 4.7.27 This mail has been rate limited because SPF does not pass.
65
+ # Gmail requires all large senders to authenticate with SPF. Authentication results:
66
+ # SPF domain-name with ip: ip-address = did not pass. To resolve this issue, go to
67
+ # Define your SPF record窶韮asic setup. https://support.google.com/a/answer/10685031
68
+ ['421', '4.7.27', 'gmail requires all large senders to authenticate with spf'],
69
+ ['550', '5.7.27', 'gmail requires all large senders to authenticate with spf'],
70
+
71
+ # - 421 4.7.28 This mail has been rate limited because DKIM does not pass.
72
+ # Gmail requires all large senders to authenticate with DKIM. Authentication results:
73
+ # DKIM = did not pass. For instructions on setting up DKIM authentication, go to Turn
74
+ # on DKIM for your domain. https://support.google.com/a/answer/180504
75
+ ['421', '4.7.28', 'gmail requires all large senders to authenticate with dkim'],
76
+ ['550', '5.7.28', 'gmail requires all large senders to authenticate with dkim'],
77
+ ],
78
+ 'badreputation' => [
79
+ # - 421 4.7.0 This message is suspicious due to the very low reputation of the sending
80
+ # IP address/domain. To protect our users from spam, mail sent from your IP address
81
+ # has been temporarily rate limited. For more information, go to Why has Gmail blocked
82
+ # my messages?. https://support.google.com/mail/answer/188131
83
+ ['421', '4.7.0', 'this message is suspicious due to the very low reputation of the sending ip address'],
84
+ ['421', '4.7.0', 'this message is suspicious due to the very low reputation of the sending domain'],
85
+
86
+ # - 550 5.7.1 Our system has detected that this message is likely suspicious due to the
87
+ # very low reputation of the sending IP address/domain. To best protect our users
88
+ # from spam, the message has been blocked.
89
+ # Please visit https://support.google.com/mail/answer/188131 for more information.
90
+ ['550', '5.7.1', 'this message is likely suspicious due to the very low reputation of the sending ip address'],
91
+ ['550', '5.7.1', 'this message is likely suspicious due to the very low reputation of the sending domain'],
92
+ ],
93
+ 'blocked' => [
94
+ # - 421 4.7.0 IP not in whitelist for RCPT domain, closing connection.
95
+ # For more information, go to Allowlists, denylists, and approved senders.
96
+ # https://support.google.com/a/answer/60752
97
+ ['421', '4.7.0', 'ip not in whitelist for rcpt domain, closing connection.'],
98
+
99
+ # - 421 4.7.0 Try again later, closing connection. This usually indicates a Denial of
100
+ # Service (DoS) for the SMTP relay at the HELO stage.
101
+ # https://support.google.com/a/answer/3221692
102
+ ['421', '4.7.0', 'try again later, closing connection.'],
103
+
104
+ # - 501 5.5.4 HELO/EHLO argument is invalid. https://support.google.com/mail/?p=helo
105
+ ['501', '5.5.4', 'empty helo/ehlo argument not allowed'],
106
+ ['501', '5.5.4', 'helo/ehlo argument is invalid'],
107
+
108
+ # - 421 4.7.28 Gmail has detected an unusual rate of unsolicited mail.
109
+ # (originating from)
110
+ # - your IP address 192.0.2.25
111
+ # - your IP Netblock 192.0.2.0/24 (?)
112
+ # - your DKIM domain example.org
113
+ # - your SPF domain example.org
114
+ # (containing one of your URL domains)
115
+ #
116
+ # To protect our users from spam, mail has been temporarily rate limited. To review
117
+ # our bulk email senders guidelines, go to Email sender guidelines.
118
+ # https://support.google.com/mail/?p=UnsolicitedRateLimitError
119
+ ['421', '4.7.0', 'an unusual rate of unsolicited mail'],
120
+ ['421', '4.7.28', 'an unusual rate of unsolicited mail'],
121
+
122
+ # - 550 5.7.1 Our system has detected an unusual rate of unsolicited mail originating
123
+ # from your IP address. To protect our users from spam, mail sent from your IP ad-
124
+ # dress has been blocked. Review https://support.google.com/mail/answer/81126
125
+ #
126
+ # - 550 5.7.28 There is an unusual rate of unsolicited mail originating from your IP
127
+ # address. To protect our users from spam, mail sent from your IP address has been
128
+ # blocked. To review our bulk email senders guidelines, go to Email sender guidelines.
129
+ ['550', '5.7.1', 'an unusual rate of unsolicited mail originating from your ip address'],
130
+ ['550', '5.7.28', 'an unusual rate of unsolicited mail originating from your ip address'],
131
+ ],
132
+ 'exceedlimit' => [
133
+ # - 552 5.2.3 Your message exceeded Google's message size limits. For more information,
134
+ # visit https://support.google.com/mail/answer/6584
135
+ ['552', '5.2.3', "your message exceeded google's message size limits"],
136
+
137
+ # - 552 5.3.4 The number of attachments (num-attachments) exceeds Google's limit of
138
+ # limit attachments. To view our attachment size guidelines, go to Gmail receiving
139
+ # limits in Google Workspace. https://support.google.com/a/answer/1366776
140
+ #
141
+ # - 552 5.3.4 The size of the <header name> header value (size bytes) exceeds Google's
142
+ # limit of limit bytes per individual header size. To view our header size guidelines,
143
+ # go to Gmail message header limits https://support.google.com/a?p=header-limits
144
+ ['552', '5.3.4', "exceeds google's limit of limit attachments."],
145
+ ['552', '5.3.4', "your message exceeded google's message header size limits"],
146
+ ['552', '5.3.4', 'bytes per individual header size'],
147
+ ['552', '5.3.4', "exceeds google窶冱 header name limit of"],
148
+ ['552', '5.3.4', "your message has a subject: header that exceeds google's message header size limit"]
149
+ ],
150
+ 'expired' => [
151
+ # - 421 4.7.0 Connection expired, try reconnecting. For more information, go to About
152
+ # SMTP error messages. https://support.google.com/a/answer/3221692
153
+ ['421', '4.7.0', 'connection expired'],
154
+
155
+ # - 451 4.4.2 Timeout - closing connection. For more information, go to About SMTP
156
+ # error messages. https://support.google.com/a/answer/3221692
157
+ ['451', '4.4.2', 'timeout - closing connection'],
158
+ ],
159
+ 'mailboxfull' => [
160
+ # - 452 4.2.2 The recipient's inbox is out of storage space.
161
+ # Please direct the recipient to https://support.google.com/mail/?p=OverQuotaTemp
162
+ # - Please direct the recipient to https://support.google.com/mail/?p=OverQuotaPerm
163
+ ['452', '4.2.2', 'inbox is out of storage space'],
164
+ ['552', '5.2.2', 'inbox is out of storage space and inactive'],
165
+
166
+ # - 452 4.2.2 The email account that you tried to reach is over quota. Please direct
167
+ # the recipient to Clear Google Drive space & increase storage.
168
+ ['452', '4.2.2', 'the email account that you tried to reach is over quota'],
169
+ ['552', '5.2.2', 'the email account that you tried to reach is over quota'],
170
+ ['550', '5.7.1', 'email quota exceeded'],
171
+ ],
172
+ 'mesgtoobig' => [
173
+ # - 552 5.3.4 Your message exceeded Google's message size limits. To view our message
174
+ # size guidelines, go to Send attachments with your Gmail message.
175
+ # - https://support.google.com/mail/?p=MaxSizeError
176
+ ['552', '5.3.4', "your message exceeded google's message size limits"],
177
+
178
+ # - 552 5.3.4 The size of your message (size bytes) exceeded Google's message size
179
+ # limits of limit bytes. To view our message size guidelines, go to Gmail receiving
180
+ # limits in Google Workspace.
181
+ # - https://support.google.com/mail/?p=MaxSizeError
182
+ ['552', '5.3.4', "exceeds google's message size limit of"],
183
+ ],
184
+ 'networkerror' => [
185
+ # - 554 5.4.6 Message exceeded 50 hops, this may indicate a mail loop.
186
+ # For more information, go to Gmail Help. https://support.google.com/mail/?p=MailLoop
187
+ ['554', '5.4.6', 'message exceeded 50 hops, this may indicate a mail loop'],
188
+ ['554', '5.6.0', 'message exceeded 50 hops, this may indicate a mail loop'],
189
+ ],
190
+ 'norelaying' => [
191
+ # - 550 5.7.0 Mail relay denied <ip-address>. Invalid credentials for relay for one of
192
+ # the domains in: <domain-name> (as obtained from HELO and MAIL FROM). Email is being
193
+ # sent from a domain or IP address which isn't registered in your Workspace account.
194
+ # Please login to your Workspace account and verify that your sending device IP
195
+ # address has been registered within the Workspace SMTP Relay Settings. For more
196
+ # information, go to SMTP relay service error messages.
197
+ # - https://support.google.com/a/answer/6140680#maildenied
198
+ ['550', '5.7.0', 'mail relay denied'],
199
+
200
+ # - 550 5.7.1 Invalid credentials for relay <ip-address>. The IP address you've
201
+ # registered in your Workspace SMTP Relay service doesn't match the domain of the
202
+ # account this email is being sent from. If you are trying to relay mail from a
203
+ # domain that isn't registered under your Workspace account or has empty
204
+ # envelope-from:, you must configure your mail server either to use SMTP AUTH to
205
+ # identify the sending domain or to present one of your domain names in the HELO or
206
+ # EHLO command. For more information, go to SMTP relay service error messages.
207
+ # - https://support.google.com/a/answer/6140680#invalidcred
208
+ ['550', '5.7.1', 'invalid credentials for relay'],
209
+
210
+ # - 550 7.7.1 The IP you're using to send mail is not authorized to send email directly
211
+ # to our servers. Use the SMTP relay at your service provider instead. For more
212
+ # information, go to 'The IP you're using to send email is not authorized...'.
213
+ # - https://support.google.com/mail/?p=NotAuthorizedError
214
+ ['550', '5.7.1', "the ip you're using to send mail is not authorized to send email directly to our servers"],
215
+ ],
216
+ 'notcompliantrfc' => [
217
+ # - 550 5.7.1 Messages missing a valid address in the From: header, or having no From:
218
+ # header, are not accepted. For more information, go to Email sender guidelines and
219
+ # review RFC 5322 specifications.
220
+ # - https://support.google.com/mail/?p=RfcMessageNonCompliant
221
+ ['550', '5.7.1', 'messages missing a valid address in the from: header'],
222
+ ['550', '5.7.1', 'messages with multiple addresses in from: header are not accepted'],
223
+
224
+ # - 550 5.7.1 This message is not RFC 5322 compliant because it has duplicate headers.
225
+ # To reduce the amount of spam sent to Gmail, this message has been blocked. For more
226
+ # information, go to Email sender guidelines and review RFC 5322 specifications.
227
+ # - https://support.google.com/mail/?p=RfcMessageNonCompliant
228
+ ['550', '5.7.1', 'this message is not rfc 5322 compliant'],
229
+
230
+ # - 550 5.7.1 Messages missing a valid Message-ID: header are not accepted. For more
231
+ # information, go to Email sender guidelines and review RFC 5322 specifications.
232
+ # - https://support.google.com/mail/?p=RfcMessageNonCompliant
233
+ ['550', '5.7.1', 'messages missing a valid message-id: header are not accepted'],
234
+
235
+ # - 550 5.7.1 The message contains a unicode character in a disallowed header.
236
+ # To review our message and header content guidelines, go to File types blocked in
237
+ # Gmail. https://support.google.com/mail/?p=BlockedMessage
238
+ ['550', '5.7.1', 'the message contains a unicode character in a disallowed header'],
239
+
240
+ # - 550 5.7.1 Encoded-word syntax is not permitted in message header header-name. To
241
+ # reduce the amount of spam sent to Gmail, this message has been blocked. For more
242
+ # information, go to Email sender guidelines and review RFC 5322 specifications.
243
+ # - https://support.google.com/mail/?p=RfcMessageNonCompliant
244
+ ['550', '5.7.1', 'encoded-word syntax is not permitted in message header'],
245
+
246
+ # - 553 5.1.7 The sender address address is not a valid RFC 5321 address. For more
247
+ # information, go to About SMTP error messages and review RFC 5321 specifications.
248
+ # - https://support.google.com/a/answer/3221692
249
+ ['553', '5.1.7', 'is not a valid rfc 5321 address'],
250
+
251
+ # - 554 5.6.0 Mail message is malformed. Not accepted. For more information, go to
252
+ # Email sender guidelines and review RFC 5322 specifications.
253
+ # - https://support.google.com/mail/?p=RfcMessageNonCompliant
254
+ ['554', '5.6.0', 'mail message is malformed. not accepted'],
255
+ ],
256
+ 'policyviolation' => [
257
+ # - 552 5.7.0 Our system detected an illegal attachment on your message. Please visit
258
+ # http://mail.google.com/support/bin/answer.py?answer=6590 to review our attachment
259
+ # guidelines.
260
+ ['552', '5.7.0', 'detected an illegal attachment on your message'],
261
+
262
+ # - 552 5.7.0 This message was blocked because its content presents a potential securi-
263
+ # ty issue. Please visit https://support.google.com/mail/?p=BlockedMessage to review
264
+ # our message content and attachment content guidelines.
265
+ ['552', '5.7.0', 'this message was blocked because its content presents a potential security issue'],
266
+
267
+ # - 550 5.7.1 The user or domain that you are sending to (or from) has a policy that
268
+ # prohibited the mail that you sent. Please contact your domain administrator for
269
+ # further details.
270
+ # For more information, visit https://support.google.com/a/answer/172179
271
+ ['550', '5.7.1', 'the user or domain that you are sending to (or from) has a policy that prohibited'],
272
+
273
+ # - 421 4.7.28 Gmail has detected this message exceeded its quota for sending messages
274
+ # with the same Message-ID:. To best protect our users, the message has been tempo-
275
+ # rarily rejected. For more information, go to Why has Gmail blocked my messages?.
276
+ # https://support.google.com/mail/answer/188131
277
+ ['421', '4.7.28', 'has detected this message exceeded its quota for sending messages with the same message-id:'],
278
+ ],
279
+ 'rejected' => [
280
+ # - 550 5.7.0, Mail Sending denied. This error occurs if the sender account is disabled
281
+ # or not registered within your Google Workspace domain.
282
+ # - https://support.google.com/a/answer/6140680#maildenied
283
+ ['550', '5.7.0', 'mail sending denied'],
284
+ ['550', '5.7.1', 'unauthenticated email is not accepted from this domain'],
285
+ ],
286
+ 'requireptr' => [
287
+ # - 550 5.7.1 This message does not meet IPv6 sending guidelines regarding PTR records
288
+ # and authentication. For more information, go to Email sender guidelines.
289
+ # https://support.google.com/mail/?p=IPv6AuthError
290
+ ['550', '5.7.1', 'this message does not meet ipv6 sending guidelines regarding ptr records and authentication'],
291
+
292
+ # - 421 4.7.0 The IP address sending this message does not have a PTR record, or the
293
+ # corresponding forward DNS entry does not point to the sending IP. To protect our
294
+ # users from spam, mail sent from your IP address has been temporarily rate limited.
295
+ # For more information, go to Email sender guidelines.
296
+ #
297
+ # - 550 5.7.25 The IP address sending this message does not have a PTR record setup, or
298
+ # the corresponding forward DNS entry does not point to the sending IP. As a policy,
299
+ # Gmail does not accept messages from IPs with missing PTR records.
300
+ # For more information, go to Email sender guidelines.
301
+ # - https://support.google.com/mail/answer/81126#ip-practices
302
+ #
303
+ # - 550 5.7.25 The sending IP does not match the IP address of the hostname specified
304
+ # in the pointer (PTR) record. For more information, go to Email sender guidelines.
305
+ # - https://support.google.com/mail/answer/81126#ip-practices
306
+ ['421', '4.7.0', 'the ip address sending this message does not have a ptr record'],
307
+ ['550', '5.7.25', 'the ip address sending this message does not have a ptr record'],
308
+ ['550', '5.7.25', 'the sending ip does not match the ip address of the hostname'],
309
+ ],
310
+ 'securityerror' => [
311
+ # - 421 4.7.0 TLS required for RCPT domain, closing connection. For more information,
312
+ # go to Email encryption in transit. https://support.google.com/mail/answer/6330403
313
+ #
314
+ # - 454 4.7.0 Too many login attempts, please try again later. For more information, go
315
+ # to Add Gmail to another email client. https://support.google.com/mail/answer/7126229
316
+ ['421', '4.7.0', 'tls required for rcpt domain, closing connection'],
317
+ ['454', '4.7.0', 'too many login attempts'],
318
+
319
+ # - 503 5.7.0 No identity changes permitted. For more information, go to About SMTP
320
+ # error messages.
321
+ ['501', '5.5.2', 'cannot decode response'], # 2FA related error, maybe.
322
+ ['503', '5.7.0', 'no identity changes permitted'],
323
+
324
+ # - 530 5.5.1 Authentication Required. For more information, visit
325
+ # https://support.google.com/accounts/troubleshooter/2402620
326
+ # - https://support.google.com/mail/?p=WantAuthError
327
+ ['530', '5.5.1', 'authentication required.'],
328
+ ['530', '5.7.0', 'authentication required.'],
329
+
330
+ # - 535 5.7.1 Application-specific password required.
331
+ # For more information, visit https://support.google.com/accounts/answer/185833
332
+ ['535', '5.7.1', 'application-specific password required'],
333
+ ['535', '5.7.9', 'application-specific password required'],
334
+
335
+ # - 535 5.7.1 Please log in with your web browser and then try again. For more infor-
336
+ # mation, visit https://support.google.com/mail/bin/accounts/answer/78754
337
+ ['535', '5.7.1', 'please log in with your web browser and then try again'],
338
+ ['534', '5.7.9', 'please log in with your web browser and then try again'],
339
+ ['534', '5.7.14', 'please log in through your web browser and then try again'],
340
+
341
+ # - 535 5.7.1 Username and Password not accepted. For more information, visit
342
+ # https://support.google.com/accounts/troubleshooter/2402620
343
+ ['535', '5.7.1', 'username and password not accepted'],
344
+ ['535', '5.7.8', 'username and password not accepted'],
345
+
346
+ # - 421 4.7.29 This mail has been rate limited because TLS wasn't used. Gmail requires
347
+ # all large senders to use TLS/SSL during SMTP. For instructions on using TLS, go to
348
+ # TLS & SSL connections. https://support.google.com/a/answer/100181
349
+ ['421', '4.7.29', 'gmail requires all large senders to use tls/ssl during smtp'],
350
+ ],
351
+ 'spamdetected' => [
352
+ # - 421 4.7.0 This message is suspicious due to the nature of the content or the links
353
+ # within. To best protect our users from spam, the message has been blocked. For more
354
+ # information, go to Why has Gmail blocked my messages?.
355
+ # https://support.google.com/mail/answer/188131
356
+ ['421', '4.7.0', 'this message is suspicious due to the nature of the content or the links within'],
357
+
358
+ # - 550 5.7.1 Our system has detected that this message is likely unsolicited mail. To
359
+ # reduce the amount of spam sent to Gmail, this message has been blocked.
360
+ # For more information, visit https://support.google.com/mail/answer/188131
361
+ # - https://support.google.com/mail/?p=UnsolicitedMessageError
362
+ ['550', '5.7.1', 'this message is likely unsolicited mail'],
363
+ ],
364
+ 'speeding' => [
365
+ # - 450 4.2.1 The user you are trying to contact is receiving mail too quickly. Please
366
+ # resend your message at a later time. If the user is able to receive mail at that
367
+ # time, your message will be delivered.
368
+ # For more information, visit https://support.google.com/mail/answer/22839
369
+ #
370
+ # - 450 4.2.1 Peak SMTP relay limit exceeded for customer. This is a temporary error.
371
+ # For more information on SMTP relay limits, please contact your administrator or
372
+ # visit https://support.google.com/a/answer/6140680
373
+ ['450', '4.2.1', 'is receiving mail too quickly'],
374
+ ['450', '4.2.1', 'peak smtp relay limit exceeded for customer'],
375
+
376
+ # - 450 4.2.1 The user you are trying to contact is receiving mail at a rate that pre-
377
+ # vents additional messages from being delivered. Please resend your message at a
378
+ # later time. If the user is able to receive mail at that time, your message will be
379
+ # delivered. For more information, visit https://support.google.com/mail/answer/6592
380
+ # - https://support.google.com/mail/?p=ReceivingRatePerm
381
+ ['450', '4.2.1', 'is receiving mail at a rate that prevents additional messages from being delivered'],
382
+ ['550', '5.2.1', 'is receiving mail at a rate that prevents additional messages from being delivered'],
383
+
384
+ # - 550 5.4.5 Daily SMTP relay limit exceeded for user. For more information on SMTP
385
+ # relay sending limits please contact your administrator or visit SMTP relay service
386
+ # error messages.
387
+ # https://support.google.com/a/answer/6140680
388
+ # - https://support.google.com/a/answer/166852
389
+ ['550', '5.4.5', 'daily sending quota exceeded'],
390
+ ['550', '5.4.5', 'daily user sending limit exceeded'],
391
+ ['550', '5.4.5', 'daily smtp relay limit exceeded for'],
392
+ ['550', '5.7.1', 'daily smtp relay limit exceeded for'],
393
+ ['550', '5.7.1', 'daily smtp relay sending limit exceeded for'],
394
+ ['550', '5.7.1', 'this mail has been rate limited'],
395
+ ],
396
+ 'suspend' => [
397
+ # - 550 5.2.1 The email account that you tried to reach is inactive.
398
+ # For more information, go to https://support.google.com/mail/?p=DisabledUser
399
+ ['550', '5.2.1', 'the email account that you tried to reach is disabled'],
400
+ ['550', '5.2.1', 'the email account that you tried to reach is inactive'],
401
+ ],
402
+ 'syntaxerror' => [
403
+ # - 523 5.7.10 SMTP protocol violation, no commands allowed to pipeline after STARTTLS.
404
+ # For more information, go to About SMTP error messages and review RFC 3207
405
+ # specifications.
406
+ ['451', '4.5.0', 'smtp protocol violation'],
407
+ ['454', '4.5.0', 'smtp protocol violation, no commands allowed to pipeline after starttls'],
408
+ ['525', '5.7.10', 'smtp protocol violation, no commands allowed to pipeline after starttls'],
409
+ ['535', '5.5.4', 'optional argument not permitted for that auth mode'],
410
+ ['454', '5.5.1', 'starttls may not be repeated'],
411
+
412
+ # - 501 5.5.2 Syntax error, cannot decode response. For more information, go to About
413
+ # SMTP error messages.
414
+ # - https://support.google.com/a/answer/3221692
415
+ # - 501 5.7.11 Syntax error (no parameters allowed). For more information, go to About
416
+ # SMTP error messages and review RFC 3207 specifications.
417
+ ['501', '5.7.11', 'syntax error'],
418
+ ['501', '5.5.2', 'syntax error'],
419
+ ['555', '5.5.2', 'syntax error'],
420
+
421
+ # - 503 5.5.1 Bad sequence of commands. For more information, go to About SMTP error
422
+ # messages and review RFC 5321 specifications.
423
+ # - https://support.google.com/mail/?p=helo
424
+ #
425
+ # - 503 5.5.1 No DATA after BDAT. A mail transaction protocol command was issued out of
426
+ # sequence. For more information, go to About SMTP error messages and review RFC 3030
427
+ # specifications.
428
+ # - https://support.google.com/a/answer/3221692
429
+ ['502', '5.5.1', 'too many unrecognized commands, goodbye'],
430
+ ['502', '5.5.1', 'unimplemented command'],
431
+ ['502', '5.5.1', 'unrecognized command'],
432
+ ['503', '5.5.1', 'bad sequence of commands'],
433
+ ['503', '5.5.1', 'ehlo/helo first'],
434
+ ['503', '5.5.1', 'mail first'],
435
+ ['503', '5.5.1', 'rcpt first'],
436
+ ['503', '5.5.1', 'no data after bdat'],
437
+ ['504', '5.7.4', 'unrecognized authentication type'],
438
+ ['504', '5.7.4', 'xoauth is no longer supported'],
439
+
440
+ # - 530 5.7.0 Must issue a STARTTLS command first. For more information, go to About
441
+ # SMTP error messages and review RFC 3207 specifications.
442
+ ['530', '5.7.0', 'must issue a starttls command first'],
443
+ ['554', '5.7.0', 'too many unauthenticated commands'],
444
+ ],
445
+ 'systemerror' => [
446
+ # About SMTP error messages, https://support.google.com/a/answer/3221692
447
+ ['421', '4.3.0', 'temporary system problem'],
448
+ ['421', '4.7.0', 'temporary system problem'],
449
+ ['421', '4.4.5', 'server busy'],
450
+
451
+ # - 451 4.3.0 Multiple destination domains per transaction is unsupported. Please try
452
+ # again. For more information, go to About SMTP error messages and review RFC 5321
453
+ # specifications. https://support.google.com/a/answer/3221692
454
+ ['451', '4.3.0', 'multiple destination domains per transaction is unsupported'],
455
+ ['451', '4.3.0', 'mail server has temporarily rejected this message'],
456
+ ['451', '4.3.0', 'mail server temporarily rejected message'],
457
+
458
+ # - 452 4.5.3 Domain policy size per transaction exceeded, please try this recipient in
459
+ # a separate transaction. This message means the email policy size (size of policies,
460
+ # number of policies, or both) for the recipient domain has been exceeded.
461
+ # https://support.google.com/a/answer/7282433
462
+ ['452', '4.5.3', 'domain policy size per transaction exceeded'],
463
+
464
+ # - 454 4.7.0 Cannot authenticate due to a temporary system problem. Try again later.
465
+ # For more information, go to About SMTP error messages.
466
+ # https://support.google.com/a/answer/3221692
467
+ ['454', '4.7.0', 'cannot authenticate due to temporary system problem'],
468
+ ],
469
+ 'toomanyconn' => [
470
+ # - 452 4.5.3 Your message has too many recipients. For more information regarding
471
+ # Google's sending limits, visit https://support.google.com/mail/answer/6592
472
+ # https://support.google.com/mail/?p=TooManyRecipientsError
473
+ ['452', '4.5.3', 'your message has too many recipients'],
474
+ ['550', '5.5.3', 'too many recipients for this sender'],
475
+ ],
476
+ 'userunknown' => [
477
+ # - 550 5.1.1 The email account that you tried to reach does not exist. Please try dou-
478
+ # ble-checking the recipient's email address for typos or unnecessary spaces.
479
+ # For more information, visit https://support.google.com/mail/answer/6596
480
+ # - https://support.google.com/mail/?p=NoSuchUser
481
+ ['550', '5.1.1', 'the email account that you tried to reach does not exist'],
482
+
483
+ # - 553 5.1.2 We weren't able to find the recipient domain. Please check for any spell-
484
+ # ing errors, and make sure you didn't enter any spaces, periods, or other punctua-
485
+ # tion after the recipient's email address.
486
+ # - https://support.google.com/mail/?p=BadRcptDomain
487
+ ['553', '5.1.2', "we weren't able to find the recipient domain"],
488
+
489
+ # - 553 5.1.3 The recipient address <address> is not a valid RFC 5321 address. For more
490
+ # information, go to About SMTP error messages and review RFC 5321 specifications.
491
+ # - https://support.google.com/a/answer/3221692
492
+ ['553', '5.1.3', 'is not a valid rfc 5321 address'],
493
+ ],
494
+ }.freeze
495
+
496
+ # Detect bounce reason from Google Workspace
497
+ # @param [Sisimai::Fact] argvs Parsed email object
498
+ # @return [String] The bounce reason for Google Workspace
499
+ # @see https://support.google.com/a/answer/3726730?hl=en
500
+ def get(argvs)
501
+ return argvs['reason'] unless argvs['reason'].empty?
502
+ return '' if argvs['diagnosticcode'].empty?
503
+ return '' unless Sisimai::SMTP::Reply.test(argvs['replycode'])
504
+ return '' unless Sisimai::SMTP::Status.test(argvs['deliverystatus'])
505
+
506
+ statuscode = argvs['deliverystatus'][2,6]
507
+ esmtpreply = argvs['replycode'][1,2]
508
+ esmtperror = argvs['diagnosticcode'].downcase
509
+ reasontext = ''
510
+
511
+ MessagesOf.each_key do |e|
512
+ # Each key is a reason name
513
+ MessagesOf[e].each do |f|
514
+ # Try to match an SMTP reply code, a D.S.N, and an error message
515
+ next unless esmtperror.include?(f[2])
516
+ next unless f[0].end_with?(esmtpreply)
517
+ next unless f[1].end_with?(statuscode)
518
+ reasontext = e
519
+ break
520
+ end
521
+ break unless reasontext.empty?
522
+ end
523
+
524
+ return reasontext
525
+ end
526
+
527
+ end
528
+ end
529
+ end
530
+ end
@@ -1,11 +1,10 @@
1
1
  module Sisimai
2
2
  module Rhost
3
- # Sisimai::Rhost detects the bounce reason from the content of Sisimai::Data
4
- # object as an argument of get() method when the value of "rhost" of the object
5
- # is "*.email.ua". This class is called only Sisimai::Data class.
3
+ # Sisimai::Rhost detects the bounce reason from the content of Sisimai::Fact object as an argument
4
+ # of get() method when the value of "rhost" of the object is "*.email.ua". This class is called
5
+ # only Sisimai::Fact class.
6
6
  module IUA
7
7
  class << self
8
- # Imported from p5-Sisimail/lib/Sisimai/Rhost/IUA.pm
9
8
  ErrorCodes = {
10
9
  # http://mail.i.ua/err/$(CODE)
11
10
  '1' => 'norelaying', # The use of SMTP as mail gate is forbidden.
@@ -21,15 +20,15 @@ module Sisimai
21
20
  }.freeze
22
21
 
23
22
  # Detect bounce reason from https://www.i.ua/
24
- # @param [Sisimai::Data] argvs Parsed email object
23
+ # @param [Sisimai::Fact] argvs Parsed email object
25
24
  # @return [String] The bounce reason at https://www.i.ua/
26
25
  def get(argvs)
27
- return argvs.reason unless argvs.reason.empty?
26
+ return argvs['reason'] unless argvs['reason'].empty?
27
+ issuedcode = argvs['diagnosticcode'].downcase
28
+ codenumber = issuedcode.index('.i.ua/err/') > 0 ? issuedcode[issuedcode.index('/err/') + 5, 2] : 0
29
+ codenumber = codenumber[0, 1] if codenumber.index('/') == 1
28
30
 
29
- if cv = argvs.diagnosticcode.downcase.match(%r|[.]i[.]ua/err/(\d+)|)
30
- return ErrorCodes[cv[1]] || ''
31
- end
32
- return ''
31
+ return ErrorCodes[codenumber] || ''
33
32
  end
34
33
 
35
34
  end