sisimai 5.1.0-java → 5.2.0-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 (192) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake-test.yml +1 -1
  3. data/ChangeLog.md +102 -0
  4. data/Makefile +4 -2
  5. data/README-JA.md +23 -16
  6. data/README.md +22 -15
  7. data/lib/sisimai/arf.rb +121 -210
  8. data/lib/sisimai/fact.rb +208 -158
  9. data/lib/sisimai/lda.rb +98 -0
  10. data/lib/sisimai/lhost/activehunter.rb +1 -1
  11. data/lib/sisimai/lhost/amazonses.rb +185 -301
  12. data/lib/sisimai/lhost/apachejames.rb +48 -51
  13. data/lib/sisimai/lhost/biglobe.rb +1 -2
  14. data/lib/sisimai/lhost/courier.rb +10 -8
  15. data/lib/sisimai/lhost/domino.rb +25 -25
  16. data/lib/sisimai/lhost/dragonfly.rb +3 -4
  17. data/lib/sisimai/lhost/einsundeins.rb +3 -4
  18. data/lib/sisimai/lhost/exchange2003.rb +6 -8
  19. data/lib/sisimai/lhost/exchange2007.rb +111 -101
  20. data/lib/sisimai/lhost/exim.rb +232 -242
  21. data/lib/sisimai/lhost/ezweb.rb +43 -51
  22. data/lib/sisimai/lhost/fml.rb +2 -3
  23. data/lib/sisimai/lhost/gmail.rb +32 -28
  24. data/lib/sisimai/lhost/gmx.rb +4 -16
  25. data/lib/sisimai/lhost/googlegroups.rb +9 -8
  26. data/lib/sisimai/lhost/googleworkspace.rb +94 -0
  27. data/lib/sisimai/lhost/imailserver.rb +7 -16
  28. data/lib/sisimai/lhost/interscanmss.rb +1 -1
  29. data/lib/sisimai/lhost/kddi.rb +3 -4
  30. data/lib/sisimai/lhost/mailfoundry.rb +2 -5
  31. data/lib/sisimai/lhost/mailmarshalsmtp.rb +1 -2
  32. data/lib/sisimai/lhost/messagingserver.rb +14 -13
  33. data/lib/sisimai/lhost/mfilter.rb +4 -3
  34. data/lib/sisimai/lhost/notes.rb +2 -4
  35. data/lib/sisimai/lhost/opensmtpd.rb +2 -2
  36. data/lib/sisimai/lhost/postfix.rb +25 -27
  37. data/lib/sisimai/lhost/qmail.rb +130 -106
  38. data/lib/sisimai/lhost/sendmail.rb +19 -18
  39. data/lib/sisimai/lhost/v5sendmail.rb +88 -60
  40. data/lib/sisimai/lhost/verizon.rb +2 -2
  41. data/lib/sisimai/lhost/x1.rb +1 -1
  42. data/lib/sisimai/lhost/x2.rb +1 -2
  43. data/lib/sisimai/lhost/x3.rb +2 -2
  44. data/lib/sisimai/lhost/x6.rb +1 -1
  45. data/lib/sisimai/lhost/zoho.rb +2 -2
  46. data/lib/sisimai/lhost.rb +18 -21
  47. data/lib/sisimai/message.rb +93 -146
  48. data/lib/sisimai/order.rb +21 -77
  49. data/lib/sisimai/reason/authfailure.rb +1 -4
  50. data/lib/sisimai/reason/badreputation.rb +2 -2
  51. data/lib/sisimai/reason/blocked.rb +7 -10
  52. data/lib/sisimai/reason/contenterror.rb +7 -1
  53. data/lib/sisimai/reason/exceedlimit.rb +1 -4
  54. data/lib/sisimai/reason/failedstarttls.rb +42 -0
  55. data/lib/sisimai/reason/filtered.rb +5 -4
  56. data/lib/sisimai/reason/hasmoved.rb +1 -2
  57. data/lib/sisimai/reason/hostunknown.rb +3 -3
  58. data/lib/sisimai/reason/mailboxfull.rb +2 -4
  59. data/lib/sisimai/reason/mailererror.rb +1 -2
  60. data/lib/sisimai/reason/mesgtoobig.rb +2 -4
  61. data/lib/sisimai/reason/norelaying.rb +2 -3
  62. data/lib/sisimai/reason/notaccept.rb +2 -3
  63. data/lib/sisimai/reason/notcompliantrfc.rb +10 -4
  64. data/lib/sisimai/reason/rejected.rb +1 -1
  65. data/lib/sisimai/reason/requireptr.rb +2 -2
  66. data/lib/sisimai/reason/securityerror.rb +1 -3
  67. data/lib/sisimai/reason/spamdetected.rb +6 -8
  68. data/lib/sisimai/reason/speeding.rb +1 -2
  69. data/lib/sisimai/reason/suppressed.rb +36 -0
  70. data/lib/sisimai/reason/suspend.rb +1 -3
  71. data/lib/sisimai/reason/systemerror.rb +5 -0
  72. data/lib/sisimai/reason/toomanyconn.rb +1 -2
  73. data/lib/sisimai/reason/userunknown.rb +1 -1
  74. data/lib/sisimai/reason/virusdetected.rb +5 -6
  75. data/lib/sisimai/reason.rb +77 -73
  76. data/lib/sisimai/rfc1123.rb +152 -0
  77. data/lib/sisimai/rfc1894.rb +102 -62
  78. data/lib/sisimai/rfc2045.rb +2 -1
  79. data/lib/sisimai/rfc3464/thirdparty.rb +102 -0
  80. data/lib/sisimai/rfc3464.rb +222 -343
  81. data/lib/sisimai/rfc3834.rb +1 -1
  82. data/lib/sisimai/rfc5322.rb +7 -17
  83. data/lib/sisimai/rfc791.rb +69 -0
  84. data/lib/sisimai/rhost/aol.rb +36 -0
  85. data/lib/sisimai/rhost/apple.rb +5 -2
  86. data/lib/sisimai/rhost/cox.rb +3 -2
  87. data/lib/sisimai/rhost/facebook.rb +100 -0
  88. data/lib/sisimai/rhost/franceptt.rb +3 -2
  89. data/lib/sisimai/rhost/godaddy.rb +3 -2
  90. data/lib/sisimai/rhost/google.rb +19 -17
  91. data/lib/sisimai/rhost/gsuite.rb +42 -0
  92. data/lib/sisimai/rhost/iua.rb +3 -3
  93. data/lib/sisimai/rhost/kddi.rb +3 -2
  94. data/lib/sisimai/rhost/messagelabs.rb +37 -0
  95. data/lib/sisimai/rhost/microsoft.rb +56 -49
  96. data/lib/sisimai/rhost/mimecast.rb +29 -27
  97. data/lib/sisimai/rhost/nttdocomo.rb +4 -3
  98. data/lib/sisimai/rhost/outlook.rb +36 -0
  99. data/lib/sisimai/rhost/spectrum.rb +3 -2
  100. data/lib/sisimai/rhost/tencent.rb +3 -2
  101. data/lib/sisimai/rhost/yahooinc.rb +4 -3
  102. data/lib/sisimai/rhost.rb +69 -39
  103. data/lib/sisimai/smtp/command.rb +31 -21
  104. data/lib/sisimai/smtp/failure.rb +103 -0
  105. data/lib/sisimai/smtp/reply.rb +29 -25
  106. data/lib/sisimai/smtp/status.rb +36 -19
  107. data/lib/sisimai/smtp/transcript.rb +15 -15
  108. data/lib/sisimai/string.rb +0 -46
  109. data/lib/sisimai/version.rb +1 -1
  110. data/set-of-emails/maildir/bsd/lhost-postfix-30.eml +81 -81
  111. data/set-of-emails/maildir/bsd/{lhost-aol-03.eml → rhost-aol-03.eml} +1264 -1264
  112. data/set-of-emails/maildir/bsd/{lhost-aol-04.eml → rhost-aol-04.eml} +1260 -1260
  113. data/set-of-emails/maildir/bsd/{lhost-aol-05.eml → rhost-aol-05.eml} +105 -105
  114. data/set-of-emails/maildir/bsd/{lhost-aol-06.eml → rhost-aol-06.eml} +105 -105
  115. data/set-of-emails/maildir/bsd/rhost-gsuite-01.eml +189 -0
  116. data/set-of-emails/maildir/bsd/rhost-gsuite-02.eml +180 -0
  117. data/set-of-emails/maildir/bsd/rhost-gsuite-03.eml +251 -0
  118. data/set-of-emails/maildir/bsd/rhost-gsuite-04.eml +211 -0
  119. data/set-of-emails/maildir/bsd/rhost-gsuite-05.eml +226 -0
  120. data/set-of-emails/maildir/bsd/rhost-gsuite-06.eml +257 -0
  121. data/set-of-emails/maildir/bsd/rhost-gsuite-07.eml +289 -0
  122. data/set-of-emails/maildir/bsd/rhost-gsuite-08.eml +231 -0
  123. data/set-of-emails/maildir/bsd/rhost-gsuite-09.eml +231 -0
  124. data/set-of-emails/maildir/bsd/rhost-gsuite-10.eml +254 -0
  125. data/set-of-emails/maildir/bsd/rhost-gsuite-11.eml +228 -0
  126. data/set-of-emails/maildir/bsd/rhost-gsuite-12.eml +271 -0
  127. data/set-of-emails/maildir/bsd/rhost-gsuite-13.eml +261 -0
  128. data/set-of-emails/maildir/bsd/rhost-gsuite-14.eml +273 -0
  129. data/set-of-emails/maildir/bsd/rhost-gsuite-15.eml +229 -0
  130. data/set-of-emails/maildir/bsd/{lhost-messagelabs-01.eml → rhost-messagelabs-01.eml} +93 -93
  131. data/set-of-emails/maildir/bsd/rhost-outlook-01.eml +72 -0
  132. data/set-of-emails/maildir/bsd/rhost-outlook-02.eml +72 -0
  133. data/set-of-emails/maildir/bsd/rhost-outlook-03.eml +72 -0
  134. data/set-of-emails/maildir/bsd/rhost-outlook-04.eml +79 -0
  135. data/set-of-emails/maildir/bsd/rhost-outlook-06.eml +75 -0
  136. data/set-of-emails/maildir/bsd/rhost-outlook-07.eml +70 -0
  137. data/set-of-emails/maildir/bsd/rhost-outlook-08.eml +70 -0
  138. data/set-of-emails/maildir/bsd/rhost-outlook-09.eml +56 -0
  139. data/set-of-emails/maildir/tmp/arf-22.eml +49 -0
  140. data/set-of-emails/maildir/tmp/arf-23.eml +49 -0
  141. data/set-of-emails/maildir/tmp/arf-24.eml +50 -0
  142. data/set-of-emails/maildir/tmp/lhost-exim-07.eml +28 -0
  143. metadata +73 -56
  144. data/lib/sisimai/lhost/amavis.rb +0 -163
  145. data/lib/sisimai/lhost/amazonworkmail.rb +0 -127
  146. data/lib/sisimai/lhost/aol.rb +0 -125
  147. data/lib/sisimai/lhost/barracuda.rb +0 -92
  148. data/lib/sisimai/lhost/bigfoot.rb +0 -125
  149. data/lib/sisimai/lhost/facebook.rb +0 -188
  150. data/lib/sisimai/lhost/gsuite.rb +0 -194
  151. data/lib/sisimai/lhost/mailru.rb +0 -214
  152. data/lib/sisimai/lhost/mcafee.rb +0 -109
  153. data/lib/sisimai/lhost/messagelabs.rb +0 -120
  154. data/lib/sisimai/lhost/mxlogic.rb +0 -198
  155. data/lib/sisimai/lhost/office365.rb +0 -252
  156. data/lib/sisimai/lhost/outlook.rb +0 -129
  157. data/lib/sisimai/lhost/powermta.rb +0 -118
  158. data/lib/sisimai/lhost/receivingses.rb +0 -126
  159. data/lib/sisimai/lhost/sendgrid.rb +0 -150
  160. data/lib/sisimai/lhost/surfcontrol.rb +0 -105
  161. data/lib/sisimai/lhost/x4.rb +0 -269
  162. data/lib/sisimai/lhost/x5.rb +0 -112
  163. data/lib/sisimai/lhost/yahoo.rb +0 -102
  164. data/lib/sisimai/lhost/yandex.rb +0 -118
  165. data/lib/sisimai/mda.rb +0 -121
  166. data/lib/sisimai/smtp/error.rb +0 -119
  167. /data/set-of-emails/maildir/bsd/{lhost-googlegroups-15.eml → lhost-googleworkspace-01.eml} +0 -0
  168. /data/set-of-emails/maildir/bsd/{lhost-x4-08.eml → lhost-x2-06.eml} +0 -0
  169. /data/set-of-emails/maildir/bsd/{lhost-gsuite-01.eml → rfc3464-51.eml} +0 -0
  170. /data/set-of-emails/maildir/bsd/{lhost-gsuite-03.eml → rfc3464-52.eml} +0 -0
  171. /data/set-of-emails/maildir/bsd/{lhost-gsuite-04.eml → rfc3464-53.eml} +0 -0
  172. /data/set-of-emails/maildir/bsd/{lhost-gsuite-05.eml → rfc3464-54.eml} +0 -0
  173. /data/set-of-emails/maildir/bsd/{lhost-gsuite-06.eml → rfc3464-55.eml} +0 -0
  174. /data/set-of-emails/maildir/bsd/{lhost-gsuite-07.eml → rfc3464-56.eml} +0 -0
  175. /data/set-of-emails/maildir/bsd/{lhost-gsuite-08.eml → rfc3464-57.eml} +0 -0
  176. /data/set-of-emails/maildir/bsd/{lhost-gsuite-09.eml → rfc3464-58.eml} +0 -0
  177. /data/set-of-emails/maildir/bsd/{lhost-gsuite-10.eml → rfc3464-59.eml} +0 -0
  178. /data/set-of-emails/maildir/bsd/{lhost-gsuite-11.eml → rfc3464-60.eml} +0 -0
  179. /data/set-of-emails/maildir/bsd/{lhost-gsuite-12.eml → rfc3464-61.eml} +0 -0
  180. /data/set-of-emails/maildir/bsd/{lhost-gsuite-13.eml → rfc3464-62.eml} +0 -0
  181. /data/set-of-emails/maildir/bsd/{lhost-gsuite-14.eml → rfc3464-63.eml} +0 -0
  182. /data/set-of-emails/maildir/bsd/{lhost-gsuite-15.eml → rfc3464-64.eml} +0 -0
  183. /data/set-of-emails/maildir/bsd/{lhost-gsuite-02.eml → rfc3464-65.eml} +0 -0
  184. /data/set-of-emails/maildir/bsd/{lhost-aol-01.eml → rhost-aol-01.eml} +0 -0
  185. /data/set-of-emails/maildir/bsd/{lhost-aol-02.eml → rhost-aol-02.eml} +0 -0
  186. /data/set-of-emails/maildir/bsd/{lhost-facebook-03.eml → rhost-facebook-03.eml} +0 -0
  187. /data/set-of-emails/maildir/bsd/{lhost-facebook-04.eml → rhost-facebook-04.eml} +0 -0
  188. /data/set-of-emails/maildir/bsd/{lhost-messagelabs-02.eml → rhost-messagelabs-02.eml} +0 -0
  189. /data/set-of-emails/maildir/bsd/{lhost-messagelabs-03.eml → rhost-messagelabs-03.eml} +0 -0
  190. /data/set-of-emails/maildir/{bsd → tmp}/rfc3464-37.eml +0 -0
  191. /data/set-of-emails/maildir/{bsd → tmp}/rfc3464-38.eml +0 -0
  192. /data/set-of-emails/maildir/{bsd → tmp}/rfc3464-39.eml +0 -0
@@ -2,7 +2,7 @@ module Sisimai
2
2
  # Sisimai::RFC5322 provide methods for checking email address.
3
3
  module RFC5322
4
4
  class << self
5
- require 'sisimai/string'
5
+ require 'sisimai/rfc791'
6
6
  require 'sisimai/address'
7
7
  HeaderTable = {
8
8
  :messageid => %w[message-id],
@@ -12,16 +12,7 @@ module Sisimai
12
12
  :addresser => %w[from return-path reply-to errors-to reverse-path x-postfix-sender envelope-from x-envelope-from],
13
13
  :recipient => %w[to delivered-to forward-path envelope-to x-envelope-to resent-to apparently-to],
14
14
  }.freeze
15
-
16
- build_flatten_rfc822header_list = lambda do
17
- # Convert HEADER: structured hash table to flatten hash table for being called from Sisimai::Lhost::*
18
- fv = {}
19
- HeaderTable.each_value do |e|
20
- e.each { |ee| fv[ee] = true }
21
- end
22
- return fv
23
- end
24
- HeaderIndex = build_flatten_rfc822header_list.call
15
+ def HEADERTABLE; return HeaderTable; end
25
16
 
26
17
  def FIELDINDEX
27
18
  return %w[
@@ -35,11 +26,10 @@ module Sisimai
35
26
 
36
27
  # Grouped RFC822 headers
37
28
  # @param [Symbol] group RFC822 Header group name
38
- # @return [Array,Hash] RFC822 Header list
29
+ # @return [Array] RFC822 Header list
39
30
  def HEADERFIELDS(group = '')
40
- return HeaderIndex if group.empty?
41
31
  return HeaderTable[group] if HeaderTable[group]
42
- return HeaderTable
32
+ return []
43
33
  end
44
34
 
45
35
  # Fields that might be long
@@ -129,7 +119,7 @@ module Sisimai
129
119
  next if token[e].nil?
130
120
  next if token[e].empty?
131
121
  next unless token[e].start_with?('[')
132
- token[e] = Sisimai::String.ipv4(token[e]).shift || ''
122
+ token[e] = Sisimai::RFC791.find(token[e]).shift || ''
133
123
  end
134
124
  token['from'] ||= ''
135
125
 
@@ -138,7 +128,7 @@ module Sisimai
138
128
  break if token['from'] == 'localhost'
139
129
  break if token['from'] == 'localhost.localdomain'
140
130
  break unless token['from'].include?('.') # A hostname without a domain name
141
- break unless Sisimai::String.ipv4(token['from']).empty?
131
+ break unless Sisimai::RFC791.find(token['from']).empty?
142
132
 
143
133
  # No need to rewrite token['from']
144
134
  right = true
@@ -223,7 +213,7 @@ module Sisimai
223
213
  # 1. Remove leading blank lines
224
214
  # 2. Remove text after the first blank line: \n\n
225
215
  # 3. Append "\n" at the end of test block when the last character is not "\n"
226
- latterpart.sub!(/\A[\r\n\s]+/, '')
216
+ latterpart.sub!(/\A\s+/, '')
227
217
  if keeps == false
228
218
  # Remove text after the first blank line: \n\n when "keeps" is false
229
219
  latterpart = latterpart[0, latterpart.index("\n\n")] if latterpart.include?("\n\n")
@@ -0,0 +1,69 @@
1
+ module Sisimai
2
+ # Sisimai::RFC791 is a class related to the Internet host
3
+ module RFC791
4
+ class << self
5
+ # Returns 1 if the argument is an IPv4 address
6
+ # @param [String] argv1 IPv4 address like "192.0.2.25"
7
+ # @return [Bool] 1: is an IPv4 address
8
+ # @since v5.2.0
9
+ def is_ipv4address(argv0)
10
+ return false if argv0.nil? || argv0.size < 7
11
+ octet = argv0.split(/[.]/); return false if octet.size != 4
12
+
13
+ octet.each do |e|
14
+ # Check each octet is between 0 and 255
15
+ return false unless e =~ /\A[0-9]{1,3}\z/
16
+ v = e.to_i
17
+ return false if v < 0 || v > 255
18
+ end
19
+ return true
20
+ end
21
+ # Find an IPv4 address from the given string
22
+ # @param [String] argv1 String including an IPv4 address
23
+ # @return [Array] List of IPv4 addresses
24
+ # @since v5.0.0
25
+ def find(argv0)
26
+ return nil if argv0.to_s.empty?
27
+ return [] if argv0.size < 7
28
+
29
+ ipv4a = []
30
+ %w|( ) [ ] ,|.each do |e|
31
+ # Rewrite: "mx.example.jp[192.0.2.1]" => "mx.example.jp 192.0.2.1"
32
+ p0 = argv0.index(e); next unless p0
33
+ argv0[p0, 1] = ' '
34
+ end
35
+
36
+ argv0.split(' ').each do |e|
37
+ # Find string including an IPv4 address
38
+ next unless e.index('.') # IPv4 address must include "." character
39
+
40
+ lx = e.size; next if lx < 7 || lx > 17 # 0.0.0.0 = 7, [255.255.255.255] = 17
41
+ cu = 0 # Cursor for seeking each octet of an IPv4 address
42
+ as = '' # ASCII Code of each character
43
+ eo = '' # Buffer of each octet of IPv4 Address
44
+
45
+ while cu < lx
46
+ # Check whether each character is a number or "." or not
47
+ as = e[cu, 1].ord
48
+ cu += 1
49
+
50
+ if as < 48 || as > 57
51
+ # The character is not a number(0-9)
52
+ break if as != 46 # The character is not "."
53
+ next if eo == '' # The current buffer is empty
54
+ break if eo.to_i > 255 # The current buffer is greater than 255
55
+ eo = ''
56
+ next
57
+ end
58
+ eo << as.chr
59
+ break if eo.to_i > 255
60
+ end
61
+ ipv4a << e if eo.size > 0 && eo.to_i < 256
62
+ end
63
+ return ipv4a
64
+ end
65
+
66
+ end
67
+ end
68
+ end
69
+
@@ -0,0 +1,36 @@
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 find() method when the value of "rhost" of the object is "*.aol.com". This class is called
5
+ # only from Sisimai::Fact class.
6
+ module Aol
7
+ class << self
8
+ MessagesOf = {
9
+ "hostunknown" => ["Host or domain name not found"],
10
+ "notaccept" => ["type=MX: Malformed or unexpected name server reply"],
11
+ }.freeze
12
+
13
+ # Detect bounce reason from Aol Mail: https://www.aol.com
14
+ # @param [Sisimai::Fact] argvs Decoded email object
15
+ # @return [String] The bounce reason for Aol
16
+ # @since v5.2.0
17
+ def find(argvs)
18
+ return "" if argvs["diagnosticcode"].empty?
19
+ issuedcode = argvs["diagnosticcode"]
20
+ reasontext = ""
21
+
22
+ MessagesOf.each_key do |e|
23
+ # Try to match the error message with message patterns defined in $MessagesOf
24
+ next unless MessagesOf[e].any? { |a| issuedcode.include?(a) }
25
+ reasontext = e
26
+ break
27
+ end
28
+
29
+ return reasontext
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
36
+
@@ -1,7 +1,7 @@
1
1
  module Sisimai
2
2
  module Rhost
3
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 "destination" of the object is "mail.icloud.com" or "apple.com".
4
+ # of find() method when the value of "destination" of the object is "mail.icloud.com" or "apple.com".
5
5
  # This class is called only Sisimai::Fact class.
6
6
  module Apple
7
7
  class << self
@@ -69,7 +69,10 @@ module Sisimai
69
69
  # https://www.postmastery.com/icloud-postmastery-page/
70
70
  # https://smtpfieldmanual.com/provider/apple
71
71
  # @since v5.1.0
72
- def get(argvs)
72
+ def find(argvs)
73
+ return '' unless argvs
74
+ return '' unless argvs['diagnosticcode'].size > 0
75
+
73
76
  issuedcode = argvs['diagnosticcode'].downcase
74
77
  reasontext = ''
75
78
 
@@ -1,7 +1,7 @@
1
1
  module Sisimai
2
2
  module Rhost
3
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 "destination" of the object is "charter.net". This class is
4
+ # of find() method when the value of "destination" of the object is "charter.net". This class is
5
5
  # called only Sisimai::Fact class.
6
6
  module Cox
7
7
  class << self
@@ -129,7 +129,8 @@ module Sisimai
129
129
  # @return [String, Nil] The bounce reason at Cox
130
130
  # @see https://www.cox.com/residential/support/email-error-codes.html
131
131
  # @since v4.25.8
132
- def get(argvs)
132
+ def find(argvs)
133
+ return "" if argvs["diagnosticcode"].empty?
133
134
  issuedcode = argvs['diagnosticcode']
134
135
  codenumber = 0
135
136
 
@@ -0,0 +1,100 @@
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 find() method when the value of "rhost" of the object is "*.facebook.com". This class is
5
+ # called only from Sisimai::Fact class.
6
+ module Facebook
7
+ class << self
8
+ ErrorCodes = {
9
+ # http://postmaster.facebook.com/response_codes
10
+ # NOT TESTD EXCEPT RCP-P2
11
+ "authfailure" => [
12
+ "POL-P7", # The message does not comply with Facebook's Domain Authentication requirements.
13
+ ],
14
+ "blocked" => [
15
+ "POL-P1", # Your mail server's IP Address is listed on the Spamhaus PBL.
16
+ "POL-P2", # Facebook will no longer accept mail from your mail server's IP Address.
17
+ "POL-P3", # Facebook is not accepting messages from your mail server. This will persist for 4 to 8 hours.
18
+ "POL-P4", # Facebook is not accepting messages from your mail server. This will persist for 24 to 48 hours.
19
+ "POL-T1", # Facebook is not accepting messages from your mail server, but they may be retried later. This will persist for 1 to 2 hours.
20
+ "POL-T2", # Facebook is not accepting messages from your mail server, but they may be retried later. This will persist for 4 to 8 hours.
21
+ "POL-T3", # Facebook is not accepting messages from your mail server, but they may be retried later. This will persist for 24 to 48 hours.
22
+ ],
23
+ "contenterror" => [
24
+ "MSG-P2", # The message contains an attachment type that Facebook does not accept.
25
+ ],
26
+ "filtered" => [
27
+ "RCP-P2", # The attempted recipient's preferences prevent messages from being delivered.
28
+ "RCP-P3", # The attempted recipient's privacy settings blocked the delivery.
29
+ ],
30
+ "mesgtoobig" => [
31
+ "MSG-P1", # The message exceeds Facebook's maximum allowed size.
32
+ "INT-P2", # The message exceeds Facebook's maximum allowed size.
33
+ ],
34
+ "notcompliantrfc" => [
35
+ "MSG-P3", # The message contains multiple instances of a header field that can only be present once.
36
+ ],
37
+ "rejected" => [
38
+ "DNS-P1", # Your SMTP MAIL FROM domain does not exist.
39
+ "DNS-P2", # Your SMTP MAIL FROM domain does not have an MX record.
40
+ "DNS-T1", # Your SMTP MAIL FROM domain exists but does not currently resolve.
41
+ ],
42
+ "requireptr" => [
43
+ "DNS-P3", # Your mail server does not have a reverse DNS record.
44
+ "DNS-T2", # You mail server's reverse DNS record does not currently resolve.
45
+ ],
46
+ "spamdetected" => [
47
+ "POL-P6", # The message contains a url that has been blocked by Facebook.
48
+ "POL-P7", # The message does not comply with Facebook's abuse policies and will not be accepted.
49
+ ],
50
+ "suspend" => [
51
+ "RCP-T4", # The attempted recipient address is currently deactivated. The user may or may not reactivate it.
52
+ ],
53
+ "systemerror" => [
54
+ "RCP-T1", # The attempted recipient address is not currently available due to an internal system issue. This is a temporary condition.
55
+ ],
56
+ "toomanyconn" => [
57
+ "CON-T1", # Facebook's mail server currently has too many connections open to allow another one.
58
+ "CON-T2", # Your mail server currently has too many connections open to Facebook's mail servers.
59
+ "CON-T3", # Your mail server has opened too many new connections to Facebook's mail servers in a short period of time.
60
+ "CON-T4", # Your mail server has exceeded the maximum number of recipients for its current connection.
61
+ "MSG-T1", # The number of recipients on the message exceeds Facebook's allowed maximum.
62
+ ],
63
+ "userunknown" => [
64
+ "RCP-P1", # The attempted recipient address does not exist.
65
+ "INT-P1", # The attempted recipient address does not exist.
66
+ "INT-P3", # The attempted recpient group address does not exist.
67
+ "INT-P4", # The attempted recipient address does not exist.
68
+ ],
69
+ "virusdetected" => [
70
+ "POL-P5", # The message contains a virus.
71
+ ],
72
+ }.freeze
73
+
74
+ # Detect bounce reason from Facebook
75
+ # @param [Sisimai::Fact] argvs Decoded email object
76
+ # @return [String] The bounce reason for Facebook
77
+ # @since v5.2.0
78
+ def find(argvs)
79
+ return "" if argvs["diagnosticcode"].empty?
80
+ return "" if argvs["diagnosticcode"].include?("-") == false
81
+
82
+ errorindex = argvs["diagnosticcode"].index("-")
83
+ errorlabel = argvs["diagnosticcode"][errorindex - 3, 6]
84
+ reasontext = ''
85
+
86
+ ErrorCodes.each_key do |e|
87
+ # The key is a bounce reason name
88
+ next unless ErrorCodes[e].any? { |a| errorlabel == a }
89
+ reasontext = e
90
+ break
91
+ end
92
+
93
+ return reasontext
94
+ end
95
+
96
+ end
97
+ end
98
+ end
99
+ end
100
+
@@ -1,7 +1,7 @@
1
1
  module Sisimai
2
2
  module Rhost
3
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 "*.laposte.net" or "*.orange.fr".
4
+ # of find() method when the value of "rhost" of the object is "*.laposte.net" or "*.orange.fr".
5
5
  # This class is called only Sisimai::Fact class.
6
6
  module FrancePTT
7
7
  class << self
@@ -127,7 +127,8 @@ module Sisimai
127
127
  # @return [String] The bounce reason for Orange or La Poste
128
128
  # @see https://www.postmastery.com/orange-postmaster-smtp-error-codes-ofr/
129
129
  # https://smtpfieldmanual.com/provider/orange
130
- def get(argvs)
130
+ def find(argvs)
131
+ return "" if argvs["diagnosticcode"].empty?
131
132
  issuedcode = argvs['diagnosticcode']
132
133
  reasontext = ''
133
134
 
@@ -1,7 +1,7 @@
1
1
  module Sisimai
2
2
  module Rhost
3
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
4
+ # of find() method when the value of "rhost" of the object is "*.secureserver.net". This class is
5
5
  # called only Sisimai::Fact class.
6
6
  module GoDaddy
7
7
  class << self
@@ -206,7 +206,8 @@ module Sisimai
206
206
  # @return [String] The bounce reason for GoDaddy
207
207
  # @see https://ca.godaddy.com/help/fix-rejected-email-with-a-bounce-error-40685
208
208
  # @since v4.22.2
209
- def get(argvs)
209
+ def find(argvs)
210
+ return "" if argvs["diagnosticcode"].empty?
210
211
  issuedcode = argvs['diagnosticcode']
211
212
  positionib = issuedcode.index(' IB') || -1
212
213
  reasontext = ''
@@ -1,7 +1,7 @@
1
1
  module Sisimai
2
2
  module Rhost
3
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
4
+ # of find() method when the value of "rhost" of the object is "aspmx.l.google.com". This class is
5
5
  # called only Sisimai::Fact class.
6
6
  module Google
7
7
  class << self
@@ -165,6 +165,22 @@ module Sisimai
165
165
  # error messages. https://support.google.com/a/answer/3221692
166
166
  ['451', '4.4.2', 'timeout - closing connection'],
167
167
  ],
168
+ 'failedstarttls' => [
169
+ # - 530 5.7.0 Must issue a STARTTLS command first. For more information, go to About
170
+ # SMTP error messages and review RFC 3207 specifications.
171
+ ['530', '5.7.0', 'must issue a starttls command first'],
172
+ ['454', '5.5.1', 'starttls may not be repeated'],
173
+
174
+ # - 421 4.7.0 TLS required for RCPT domain, closing connection. For more information,
175
+ # go to Email encryption in transit. https://support.google.com/mail/answer/6330403
176
+ ['421', '4.7.0', 'tls required for rcpt domain'],
177
+
178
+ # - 421 4.7.29 Your email has been rate limited because this message wasn't sent over a
179
+ # TLS connection. Gmail requires all bulk email senders to use TLS/SSL for SMTP conn-
180
+ # ections.
181
+ ['421', '4.7.29', 'senders to use tls/ssl for smtp'],
182
+ ['550', '5.7.29', 'senders to use tls/ssl for smtp'],
183
+ ],
168
184
  'mailboxfull' => [
169
185
  # - 452 4.2.2 The recipient's inbox is out of storage space.
170
186
  # Please direct the recipient to https://support.google.com/mail/?p=OverQuotaTemp
@@ -322,12 +338,8 @@ module Sisimai
322
338
  ['550', '5.7.25', 'does not match the ip address of the hostname'],
323
339
  ],
324
340
  'securityerror' => [
325
- # - 421 4.7.0 TLS required for RCPT domain, closing connection. For more information,
326
- # go to Email encryption in transit. https://support.google.com/mail/answer/6330403
327
- #
328
341
  # - 454 4.7.0 Too many login attempts, please try again later. For more information, go
329
342
  # to Add Gmail to another email client. https://support.google.com/mail/answer/7126229
330
- ['421', '4.7.0', 'tls required for rcpt domain'],
331
343
  ['454', '4.7.0', 'too many login attempts'],
332
344
 
333
345
  # - 503 5.7.0 No identity changes permitted. For more information, go to About SMTP
@@ -356,12 +368,6 @@ module Sisimai
356
368
  # https://support.google.com/accounts/troubleshooter/2402620
357
369
  ['535', '5.7.1', 'username and password not accepted'],
358
370
  ['535', '5.7.8', 'username and password not accepted'],
359
-
360
- # - 421 4.7.29 Your email has been rate limited because this message wasn't sent over a
361
- # TLS connection. Gmail requires all bulk email senders to use TLS/SSL for SMTP conn-
362
- # ections.
363
- ['421', '4.7.29', 'senders to use tls/ssl for smtp'],
364
- ['550', '5.7.29', 'senders to use tls/ssl for smtp'],
365
371
  ],
366
372
  'spamdetected' => [
367
373
  # - 421 4.7.0 This message is suspicious due to the nature of the content or the links
@@ -422,7 +428,6 @@ module Sisimai
422
428
  ['454', '4.5.0', 'smtp protocol violation'],
423
429
  ['525', '5.7.10', 'smtp protocol violation'],
424
430
  ['535', '5.5.4', 'optional argument not permitted'],
425
- ['454', '5.5.1', 'starttls may not be repeated'],
426
431
 
427
432
  # - 501 5.5.2 Syntax error, cannot decode response. For more information, go to About
428
433
  # SMTP error messages.
@@ -451,10 +456,6 @@ module Sisimai
451
456
  ['503', '5.5.1', 'no data after bdat'],
452
457
  ['504', '5.7.4', 'unrecognized authentication type'],
453
458
  ['504', '5.7.4', 'xoauth is no longer supported'],
454
-
455
- # - 530 5.7.0 Must issue a STARTTLS command first. For more information, go to About
456
- # SMTP error messages and review RFC 3207 specifications.
457
- ['530', '5.7.0', 'must issue a starttls command first'],
458
459
  ['554', '5.7.0', 'too many unauthenticated commands'],
459
460
  ],
460
461
  'systemerror' => [
@@ -512,7 +513,8 @@ module Sisimai
512
513
  # @param [Sisimai::Fact] argvs Decoded email object
513
514
  # @return [String] The bounce reason for Google Workspace
514
515
  # @see https://support.google.com/a/answer/3726730?hl=en
515
- def get(argvs)
516
+ def find(argvs)
517
+ return "" if argvs["diagnosticcode"].empty?
516
518
  return '' unless Sisimai::SMTP::Reply.test(argvs['replycode'])
517
519
  return '' unless Sisimai::SMTP::Status.test(argvs['deliverystatus'])
518
520
 
@@ -0,0 +1,42 @@
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 find() method when the value of "rhost" of the object is "*.googlemail.com". This class is
5
+ # called only from Sisimai::Fact class.
6
+ module GSuite
7
+ class << self
8
+ MessagesOf = {
9
+ "hostunknown" => [" responded with code NXDOMAIN", "Domain name not found"],
10
+ "networkerror" => [" had no relevant answers.", "responded with code NXDOMAIN", "Domain name not found"],
11
+ "notaccept" => ["Null MX"],
12
+ "userunknown" => ["because the address couldn't be found. Check for typos or unnecessary spaces and try again."],
13
+ }.freeze
14
+
15
+ # Detect bounce reason from Gsuite Mail: https://www.aol.com
16
+ # @param [Sisimai::Fact] argvs Decoded email object
17
+ # @return [String] The bounce reason for Gsuite
18
+ # @since v5.2.0
19
+ def find(argvs)
20
+ return "" if argvs["diagnosticcode"].empty?
21
+ statuscode = ""; statuscode = argvs["deliverystatus"][0, 1] if argvs["deliverystatus"].empty? == false
22
+ esmtpreply = ""; esmtpreply = argvs["replycode"][0, 1] if argvs["replycode"].empty? == false
23
+ reasontext = ""
24
+
25
+ MessagesOf.each_key do |e|
26
+ # Try to match the error message with message patterns defined in $MessagesOf
27
+ next unless MessagesOf[e].any? { |a| argvs["diagnosticcode"].include?(a) }
28
+ next if e == "networkerror" && (statuscode == "5" || esmtpreply == "5")
29
+ next if e == "hostunknown" && (statuscode == "4" || statuscode == "")
30
+ next if e == "hostunknown" && (esmtpreply == "4" || esmtpreply == "")
31
+ reasontext = e
32
+ break
33
+ end
34
+
35
+ return reasontext
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+ end
42
+
@@ -1,7 +1,7 @@
1
1
  module Sisimai
2
2
  module Rhost
3
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
4
+ # of find() method when the value of "rhost" of the object is "*.email.ua". This class is called
5
5
  # only Sisimai::Fact class.
6
6
  module IUA
7
7
  class << self
@@ -22,8 +22,8 @@ module Sisimai
22
22
  # Detect bounce reason from https://www.i.ua/
23
23
  # @param [Sisimai::Fact] argvs Decoded email object
24
24
  # @return [String] The bounce reason at https://www.i.ua/
25
- def get(argvs)
26
- return argvs['reason'] unless argvs['reason'].empty?
25
+ def find(argvs)
26
+ return "" if argvs["diagnosticcode"].empty?
27
27
  issuedcode = argvs['diagnosticcode'].downcase
28
28
  codenumber = issuedcode.index('.i.ua/err/') > 0 ? issuedcode[issuedcode.index('/err/') + 5, 2] : 0
29
29
  codenumber = codenumber[0, 1] if codenumber.index('/') == 1
@@ -1,7 +1,7 @@
1
1
  module Sisimai
2
2
  module Rhost
3
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 "lsean.ezweb.ne.jp" or "msmx.au.com".
4
+ # of find() method when the value of "rhost" of the object is "lsean.ezweb.ne.jp" or "msmx.au.com".
5
5
  # This class is called only Sisimai::Fact class.
6
6
  module KDDI
7
7
  class << self
@@ -14,7 +14,8 @@ module Sisimai
14
14
  # @param [Sisimai::Fact] argvs Decoded email object
15
15
  # @return [String] The bounce reason for au.com or ezweb.ne.jp
16
16
  # @since v4.22.6
17
- def get(argvs)
17
+ def find(argvs)
18
+ return "" if argvs["diagnosticcode"].empty?
18
19
  issuedcode = argvs['diagnosticcode'].downcase
19
20
  reasontext = ''
20
21
 
@@ -0,0 +1,37 @@
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 find() method when the value of "rhost" of the object is "*.messagelabs.com". This class is
5
+ # called only from Sisimai::Fact class.
6
+ module MessageLabs
7
+ class << self
8
+ MessagesOf = {
9
+ "securityerror" => ["Please turn on SMTP Authentication in your mail client"],
10
+ "userunknown" => ["542 ", " Rejected", "No such user"],
11
+ }.freeze
12
+
13
+ # Detect bounce reason from Email Security (formerly MessageLabs.com)
14
+ # @param [Sisimai::Fact] argvs Decoded email object
15
+ # @return [String] The bounce reason for MessageLabs
16
+ # @see https://www.broadcom.com/products/cybersecurity/email
17
+ # @since v5.2.0
18
+ def find(argvs)
19
+ return "" if argvs["diagnosticcode"].empty?
20
+ issuedcode = argvs["diagnosticcode"]
21
+ reasontext = ""
22
+
23
+ MessagesOf.each_key do |e|
24
+ # Try to match the error message with message patterns defined in $MessagesOf
25
+ next unless MessagesOf[e].any? { |a| issuedcode.include?(a) }
26
+ reasontext = e
27
+ break
28
+ end
29
+
30
+ return reasontext
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end
37
+