sisimai 5.6.0-java → 5.7.1-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 (130) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake-test.yml +0 -4
  3. data/ChangeLog.md +47 -0
  4. data/README-JA.md +19 -16
  5. data/README.md +23 -21
  6. data/lib/sisimai/address.rb +8 -31
  7. data/lib/sisimai/arf.rb +5 -6
  8. data/lib/sisimai/eb.rb +116 -0
  9. data/lib/sisimai/fact.rb +33 -51
  10. data/lib/sisimai/lda.rb +20 -18
  11. data/lib/sisimai/lhost/activehunter.rb +0 -2
  12. data/lib/sisimai/lhost/amazonses.rb +17 -18
  13. data/lib/sisimai/lhost/apachejames.rb +0 -1
  14. data/lib/sisimai/lhost/biglobe.rb +0 -16
  15. data/lib/sisimai/lhost/courier.rb +9 -7
  16. data/lib/sisimai/lhost/deutschetelekom.rb +120 -0
  17. data/lib/sisimai/lhost/domino.rb +2 -4
  18. data/lib/sisimai/lhost/dragonfly.rb +0 -27
  19. data/lib/sisimai/lhost/einsundeins.rb +4 -12
  20. data/lib/sisimai/lhost/exchange2003.rb +12 -11
  21. data/lib/sisimai/lhost/exchange2007.rb +17 -17
  22. data/lib/sisimai/lhost/exim.rb +34 -81
  23. data/lib/sisimai/lhost/ezweb.rb +15 -51
  24. data/lib/sisimai/lhost/fml.rb +8 -32
  25. data/lib/sisimai/lhost/gmail.rb +10 -32
  26. data/lib/sisimai/lhost/gmx.rb +7 -24
  27. data/lib/sisimai/lhost/googlegroups.rb +6 -5
  28. data/lib/sisimai/lhost/googleworkspace.rb +2 -5
  29. data/lib/sisimai/lhost/imailserver.rb +4 -9
  30. data/lib/sisimai/lhost/kddi.rb +8 -21
  31. data/lib/sisimai/lhost/mailfoundry.rb +0 -2
  32. data/lib/sisimai/lhost/mailmarshal.rb +1 -3
  33. data/lib/sisimai/lhost/messagingserver.rb +4 -15
  34. data/lib/sisimai/lhost/mfilter.rb +0 -1
  35. data/lib/sisimai/lhost/mimecast.rb +0 -1
  36. data/lib/sisimai/lhost/notes.rb +3 -3
  37. data/lib/sisimai/lhost/opensmtpd.rb +0 -40
  38. data/lib/sisimai/lhost/postfix.rb +14 -14
  39. data/lib/sisimai/lhost/qmail.rb +23 -89
  40. data/lib/sisimai/lhost/sendmail.rb +8 -7
  41. data/lib/sisimai/lhost/trendmicro.rb +5 -4
  42. data/lib/sisimai/lhost/v5sendmail.rb +2 -2
  43. data/lib/sisimai/lhost/verizon.rb +4 -4
  44. data/lib/sisimai/lhost/x1.rb +1 -2
  45. data/lib/sisimai/lhost/x2.rb +0 -2
  46. data/lib/sisimai/lhost/x3.rb +4 -9
  47. data/lib/sisimai/lhost/x6.rb +0 -1
  48. data/lib/sisimai/lhost/zoho.rb +0 -12
  49. data/lib/sisimai/lhost.rb +38 -19
  50. data/lib/sisimai/message.rb +1 -1
  51. data/lib/sisimai/order.rb +4 -1
  52. data/lib/sisimai/reason/authfailure.rb +8 -7
  53. data/lib/sisimai/reason/badreputation.rb +5 -4
  54. data/lib/sisimai/reason/blocked.rb +6 -5
  55. data/lib/sisimai/reason/contenterror.rb +8 -5
  56. data/lib/sisimai/reason/delivered.rb +3 -2
  57. data/lib/sisimai/reason/emailtoolarge.rb +7 -6
  58. data/lib/sisimai/reason/expired.rb +16 -4
  59. data/lib/sisimai/reason/failedstarttls.rb +5 -3
  60. data/lib/sisimai/reason/feedback.rb +2 -1
  61. data/lib/sisimai/reason/filtered.rb +9 -8
  62. data/lib/sisimai/reason/hasmoved.rb +5 -4
  63. data/lib/sisimai/reason/hostunknown.rb +14 -4
  64. data/lib/sisimai/reason/mailboxfull.rb +10 -8
  65. data/lib/sisimai/reason/mailererror.rb +3 -2
  66. data/lib/sisimai/reason/networkerror.rb +16 -3
  67. data/lib/sisimai/reason/norelaying.rb +8 -6
  68. data/lib/sisimai/reason/notaccept.rb +15 -7
  69. data/lib/sisimai/reason/notcompliantrfc.rb +5 -3
  70. data/lib/sisimai/reason/onhold.rb +8 -7
  71. data/lib/sisimai/reason/policyviolation.rb +11 -5
  72. data/lib/sisimai/reason/ratelimited.rb +5 -4
  73. data/lib/sisimai/reason/rejected.rb +24 -14
  74. data/lib/sisimai/reason/requireptr.rb +5 -4
  75. data/lib/sisimai/reason/securityerror.rb +5 -3
  76. data/lib/sisimai/reason/spamdetected.rb +6 -5
  77. data/lib/sisimai/reason/suppressed.rb +4 -3
  78. data/lib/sisimai/reason/suspend.rb +8 -3
  79. data/lib/sisimai/reason/syntaxerror.rb +5 -11
  80. data/lib/sisimai/reason/systemerror.rb +21 -2
  81. data/lib/sisimai/reason/systemfull.rb +4 -3
  82. data/lib/sisimai/reason/undefined.rb +2 -1
  83. data/lib/sisimai/reason/userunknown.rb +15 -9
  84. data/lib/sisimai/reason/vacation.rb +2 -1
  85. data/lib/sisimai/reason/virusdetected.rb +6 -5
  86. data/lib/sisimai/reason.rb +47 -42
  87. data/lib/sisimai/rfc1123.rb +1 -1
  88. data/lib/sisimai/rfc1894.rb +15 -8
  89. data/lib/sisimai/rfc2045.rb +8 -5
  90. data/lib/sisimai/rfc3464/thirdparty.rb +11 -10
  91. data/lib/sisimai/rfc3464.rb +10 -14
  92. data/lib/sisimai/rfc3834.rb +6 -5
  93. data/lib/sisimai/rfc791.rb +3 -38
  94. data/lib/sisimai/rhost/aol.rb +3 -2
  95. data/lib/sisimai/rhost/apple.rb +12 -11
  96. data/lib/sisimai/rhost/cloudflare.rb +3 -2
  97. data/lib/sisimai/rhost/cox.rb +38 -37
  98. data/lib/sisimai/rhost/facebook.rb +17 -16
  99. data/lib/sisimai/rhost/franceptt.rb +39 -38
  100. data/lib/sisimai/rhost/godaddy.rb +35 -34
  101. data/lib/sisimai/rhost/google.rb +22 -21
  102. data/lib/sisimai/rhost/gsuite.rb +8 -7
  103. data/lib/sisimai/rhost/iua.rb +11 -10
  104. data/lib/sisimai/rhost/kddi.rb +3 -2
  105. data/lib/sisimai/rhost/messagelabs.rb +13 -12
  106. data/lib/sisimai/rhost/microsoft.rb +37 -32
  107. data/lib/sisimai/rhost/mimecast.rb +18 -17
  108. data/lib/sisimai/rhost/nttdocomo.rb +10 -9
  109. data/lib/sisimai/rhost/outlook.rb +3 -2
  110. data/lib/sisimai/rhost/spectrum.rb +19 -18
  111. data/lib/sisimai/rhost/tencent.rb +10 -9
  112. data/lib/sisimai/rhost/yahooinc.rb +11 -10
  113. data/lib/sisimai/rhost/zoho.rb +8 -7
  114. data/lib/sisimai/rhost.rb +1 -1
  115. data/lib/sisimai/smtp/command.rb +13 -8
  116. data/lib/sisimai/smtp/failure.rb +9 -8
  117. data/lib/sisimai/smtp/reply.rb +23 -22
  118. data/lib/sisimai/smtp/status.rb +164 -159
  119. data/lib/sisimai/smtp/transcript.rb +3 -2
  120. data/lib/sisimai/string.rb +0 -12
  121. data/lib/sisimai/version.rb +1 -1
  122. data/lib/sisimai.rb +2 -1
  123. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-01.eml +66 -0
  124. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-02.eml +68 -0
  125. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-03.eml +50 -0
  126. data/set-of-emails/maildir/bsd/lhost-postfix-81.eml +130 -0
  127. data/set-of-emails/should-not-crash/go-423-deeply-nested-mime-parts.eml +20050 -0
  128. data/set-of-emails/should-not-crash/p5-664-iomart-mail-filter.eml +258 -0
  129. data/set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet/.gitkeep +0 -0
  130. metadata +11 -2
@@ -155,6 +155,12 @@
155
155
  # X.3.5 --- System incorrectly configured:(RFC 3463)
156
156
  # The system is not configured in a manner that will permit it to accept this
157
157
  # message.
158
+ #
159
+ # X.3.6 250 Requested priority was changed:(RFC 6710)
160
+ # 251 The message was accepted for relay/delivery, but the requested priority (possibly
161
+ # the implied default) was not honored. The human readable text after the status
162
+ # code contains the new priority, followed by SP (space) and explanatory human
163
+ # readable text.
158
164
  # -------------------------------------------------------------------------------------------------
159
165
  # X.4.0 --- Other or undefined network or routing status:(RFC 3463)
160
166
  # Something went wrong with the networking, but it is not clear what the problem is,
@@ -391,7 +397,7 @@
391
397
  # 5xx temporary, for example the server is operating in a mode where only higher
392
398
  # priority messages below certain size are accepted for transfer and delivery.
393
399
  #
394
- # X.7.17 5xx Mailbox owner has changed:(RFC 6710)
400
+ # X.7.17 5xx Mailbox owner has changed:(RFC 7293)
395
401
  # This status code is returned when a message is received with a
396
402
  # Require-Recipient-Valid-Since field or RRVS extension and the receiving system is
397
403
  # able to determine that the intended recipient mailbox has not been under
@@ -479,6 +485,7 @@ module Sisimai
479
485
  # reason from D.S.N. value, and getting D.S.N. from the text including D.S.N.
480
486
  module Status
481
487
  class << self
488
+ require "sisimai/eb"
482
489
  require "sisimai/rfc791"
483
490
 
484
491
  CodePatterns = [
@@ -488,150 +495,150 @@ module Sisimai
488
495
  %r/\b(2[.][0-7][.][0-7])\b/, # 2.1.5
489
496
  ]
490
497
  StandardCode = {
491
- '2.1.5' => 'delivered', # Successfully delivered
498
+ '2.1.5' => Sisimai::Eb::ReSENT, # Successfully delivered
492
499
  # ---------------------------------------------------------------------------------------
493
- '4.1.6' => 'hasmoved', # Destination mailbox has moved, No forwarding address
494
- '4.1.7' => 'rejected', # Bad sender's mailbox address syntax
495
- '4.1.8' => 'rejected', # Bad sender's system address
496
- '4.1.9' => 'systemerror', # Message relayed to non-compliant mailer
497
- '4.2.1' => 'suspend', # Mailbox disabled, not accepting messages
498
- '4.2.2' => 'mailboxfull', # Mailbox full
499
- '4.2.3' => 'emailtoolarge', # Message length exceeds administrative limit
500
- '4.2.4' => 'systemerror', # Mailing list expansion problem
501
- # '4.3.0' => 'systemerror', # Other or undefined mail system status
502
- '4.3.1' => 'systemfull', # Mail system full
503
- '4.3.2' => 'notaccept', # System not accepting network messages
504
- '4.3.3' => 'systemerror', # System not capable of selected features
505
- '4.3.5' => 'systemerror', # System incorrectly configured
506
- # '4.4.0' => 'networkerror', # Other or undefined network or routing status
507
- '4.4.1' => 'expired', # No answer from host
508
- '4.4.2' => 'networkerror', # Bad connection
509
- '4.4.3' => 'systemerror', # Directory server failure
510
- '4.4.4' => 'networkerror', # Unable to route
511
- '4.4.5' => 'systemfull', # Mail system congestion
512
- '4.4.6' => 'networkerror', # Routing loop detected
513
- '4.4.7' => 'expired', # Delivery time expired
514
- '4.4.8' => 'networkerror', # Retry on IPv4
515
- # '4.5.0' => 'networkerror', # Other or undefined protocol status
516
- '4.5.3' => 'ratelimited', # Too many recipients
517
- '4.5.5' => 'systemerror', # Wrong protocol version
518
- '4.6.0' => 'contenterror', # Other or undefined media error
519
- '4.6.2' => 'contenterror', # Conversion required and prohibited
520
- '4.6.5' => 'contenterror', # Conversion Failed
521
- # :'4.7.0' => 'securityerror', # Other or undefined security status
522
- '4.7.1' => 'blocked', # Delivery not authorized, message refused
523
- '4.7.2' => 'rejected', # Mailing list expansion prohibited
524
- '4.7.5' => 'securityerror', # Cryptographic failure
525
- '4.7.6' => 'securityerror', # Cryptographic algorithm not supported
526
- '4.7.7' => 'securityerror', # Message integrity failure
527
- '4.7.12' => 'securityerror', # A password transition is needed
528
- '4.7.15' => 'securityerror', # Priority Level is too low
529
- '4.7.16' => 'emailtoolarge', # Message is too big for the specified priority
530
- '4.7.24' => 'authfailure ', # SPF validation error
531
- '4.7.25' => 'requireptr', # Reverse DNS validation failed
500
+ '4.1.6' => Sisimai::Eb::ReMOVE, # Destination mailbox has moved, No forwarding address
501
+ '4.1.7' => Sisimai::Eb::ReFROM, # Bad sender's mailbox address syntax
502
+ '4.1.8' => Sisimai::Eb::ReFROM, # Bad sender's system address
503
+ '4.1.9' => Sisimai::Eb::RePROC, # Message relayed to non-compliant mailer
504
+ '4.2.1' => Sisimai::Eb::ReQUIT, # Mailbox disabled, not accepting messages
505
+ '4.2.2' => Sisimai::Eb::ReFULL, # Mailbox full
506
+ '4.2.3' => Sisimai::Eb::ReSIZE, # Message length exceeds administrative limit
507
+ '4.2.4' => Sisimai::Eb::RePROC, # Mailing list expansion problem
508
+ #'4.3.0' => Sisimai::Eb::ReSAFE, # Other or undefined mail system status
509
+ '4.3.1' => Sisimai::Eb::ReDISK, # Mail system full
510
+ '4.3.2' => Sisimai::Eb::Re00MX, # System not accepting network messages
511
+ '4.3.3' => Sisimai::Eb::RePROC, # System not capable of selected features
512
+ '4.3.5' => Sisimai::Eb::RePROC, # System incorrectly configured
513
+ #'4.4.0' => Sisimai::Eb::ReINET, # Other or undefined network or routing status
514
+ '4.4.1' => Sisimai::Eb::ReTIME, # No answer from host
515
+ '4.4.2' => Sisimai::Eb::ReINET, # Bad connection
516
+ '4.4.3' => Sisimai::Eb::RePROC, # Directory server failure
517
+ '4.4.4' => Sisimai::Eb::ReINET, # Unable to route
518
+ '4.4.5' => Sisimai::Eb::ReDISK, # Mail system congestion
519
+ '4.4.6' => Sisimai::Eb::ReINET, # Routing loop detected
520
+ '4.4.7' => Sisimai::Eb::ReTIME, # Delivery time expired
521
+ '4.4.8' => Sisimai::Eb::ReINET, # Retry on IPv4
522
+ #'4.5.0' => Sisimai::Eb::ReINET, # Other or undefined protocol status
523
+ '4.5.3' => Sisimai::Eb::ReRATE, # Too many recipients
524
+ '4.5.5' => Sisimai::Eb::RePROC, # Wrong protocol version
525
+ '4.6.0' => Sisimai::Eb::ReBODY, # Other or undefined media error
526
+ '4.6.2' => Sisimai::Eb::ReBODY, # Conversion required and prohibited
527
+ '4.6.5' => Sisimai::Eb::ReBODY, # Conversion Failed
528
+ #'4.7.0' => Sisimai::Eb::ReSAFE, # Other or undefined security status
529
+ '4.7.1' => Sisimai::Eb::ReBLOC, # Delivery not authorized, message refused
530
+ '4.7.2' => Sisimai::Eb::ReFROM, # Mailing list expansion prohibited
531
+ '4.7.5' => Sisimai::Eb::ReSAFE, # Cryptographic failure
532
+ '4.7.6' => Sisimai::Eb::ReSAFE, # Cryptographic algorithm not supported
533
+ '4.7.7' => Sisimai::Eb::ReSAFE, # Message integrity failure
534
+ '4.7.12' => Sisimai::Eb::ReSAFE, # A password transition is needed
535
+ '4.7.15' => Sisimai::Eb::ReSAFE, # Priority Level is too low
536
+ '4.7.16' => Sisimai::Eb::ReSIZE, # Message is too big for the specified priority
537
+ '4.7.24' => Sisimai::Eb::ReAUTH, # SPF validation error
538
+ '4.7.25' => Sisimai::Eb::ReQPTR, # Reverse DNS validation failed
532
539
  # ---------------------------------------------------------------------------------------
533
- '5.1.0' => 'userunknown', # Other address status
534
- '5.1.1' => 'userunknown', # Bad destination mailbox address
535
- '5.1.2' => 'hostunknown', # Bad destination system address
536
- '5.1.3' => 'userunknown', # Bad destination mailbox address syntax
537
- '5.1.4' => 'filtered', # Destination mailbox address ambiguous
538
- '5.1.6' => 'hasmoved', # Destination mailbox has moved, No forwarding address
539
- '5.1.7' => 'rejected', # Bad sender's mailbox address syntax
540
- '5.1.8' => 'rejected', # Bad sender's system address
541
- '5.1.9' => 'systemerror', # Message relayed to non-compliant mailer
542
- '5.1.10' => 'notaccept', # Recipient address has null MX
543
- '5.2.0' => 'filtered', # Other or undefined mailbox status
544
- '5.2.1' => 'filtered', # Mailbox disabled, not accepting messages
545
- '5.2.2' => 'mailboxfull', # Mailbox full
546
- '5.2.3' => 'emailtoolarge', # Message length exceeds administrative limit
547
- '5.2.4' => 'systemerror', # Mailing list expansion problem
548
- '5.3.0' => 'systemerror', # Other or undefined mail system status
549
- '5.3.1' => 'systemfull', # Mail system full
550
- '5.3.2' => 'notaccept', # System not accepting network messages
551
- '5.3.3' => 'systemerror', # System not capable of selected features
552
- '5.3.4' => 'emailtoolarge', # Message too big for system
553
- '5.3.5' => 'systemerror', # System incorrectly configured
554
- '5.4.0' => 'networkerror', # Other or undefined network or routing status
555
- '5.4.3' => 'systemerror', # Directory server failure
556
- '5.4.4' => 'hostunknown', # Unable to route
557
- '5.5.2' => 'systemerror', # If the server cannot BASE64 decode any client response (AUTH)
558
- '5.5.3' => 'ratelimited', # Too many recipients
559
- '5.5.4' => 'systemerror', # Invalid command arguments
560
- '5.5.5' => 'systemerror', # Wrong protocol version
561
- '5.5.6' => 'syntaxerror', # Authentication Exchange line is too long
562
- '5.6.0' => 'contenterror', # Other or undefined media error
563
- '5.6.1' => 'contenterror', # Media not supported
564
- '5.6.2' => 'contenterror', # Conversion required and prohibited
565
- '5.6.3' => 'contenterror', # Conversion required but not supported
566
- '5.6.5' => 'contenterror', # Conversion Failed
567
- '5.6.6' => 'contenterror', # Message content not available
568
- '5.6.7' => 'rejected', # Non-ASCII addresses not permitted for that sender/recipient
569
- '5.6.8' => 'contenterror', # UTF-8 string reply is required, but not permitted by the SMTP client
570
- '5.6.9' => 'contenterror', # UTF-8 header message cannot be transferred to one or more recipients
571
- '5.7.0' => 'securityerror', # Other or undefined security status
572
- '5.7.1' => 'securityerror', # Delivery not authorized, message refused
573
- '5.7.2' => 'securityerror', # Mailing list expansion prohibited
574
- '5.7.3' => 'securityerror', # Security conversion required but not possible
575
- '5.7.4' => 'securityerror', # Security features not supported
576
- '5.7.5' => 'securityerror', # Cryptographic failure
577
- '5.7.6' => 'securityerror', # Cryptographic algorithm not supported
578
- '5.7.7' => 'securityerror', # Message integrity failure
579
- '5.7.8' => 'securityerror', # Authentication credentials invalid
580
- '5.7.9' => 'securityerror', # Authentication mechanism is too weak
581
- '5.7.10' => 'securityerror', # Encryption Needed
582
- '5.7.11' => 'securityerror', # Encryption required for requested authentication mechanism
583
- '5.7.13' => 'suspend', # User Account Disabled
584
- '5.7.14' => 'securityerror', # Trust relationship required
585
- '5.7.15' => 'securityerror', # Priority Level is too low
586
- '5.7.16' => 'emailtoolarge', # Message is too big for the specified priority
587
- '5.7.17' => 'hasmoved', # Mailbox owner has changed
588
- '5.7.18' => 'hasmoved', # Domain owner has changed
589
- '5.7.19' => 'systemerror', # RRVS test cannot be completed
590
- '5.7.20' => 'authfailure', # No passing DKIM signature found
591
- '5.7.21' => 'authfailure', # No acceptable DKIM signature found
592
- '5.7.22' => 'authfailure', # No valid author-matched DKIM signature found
593
- '5.7.23' => 'authfailure', # SPF validation failed
594
- '5.7.24' => 'authfailure', # SPF validation error
595
- '5.7.25' => 'requireptr', # Reverse DNS validation failed
596
- '5.7.26' => 'authfailure', # Multiple authentication checks failed
597
- '5.7.27' => 'notaccept', # MX resource record of a destination host is Null MX: RFC7505
598
- '5.7.28' => 'spamdetected', # The message appears to be part of a mail flood of similar abusive messages.
599
- '5.7.29' => 'authfailure', # This status code may be returned when a message fails ARC validation.
600
- '5.7.30' => 'failedstarttls', # REQUIRETLS support required
540
+ '5.1.0' => Sisimai::Eb::ReUSER, # Other address status
541
+ '5.1.1' => Sisimai::Eb::ReUSER, # Bad destination mailbox address
542
+ '5.1.2' => Sisimai::Eb::ReHOST, # Bad destination system address
543
+ '5.1.3' => Sisimai::Eb::ReUSER, # Bad destination mailbox address syntax
544
+ '5.1.4' => Sisimai::Eb::ReFILT, # Destination mailbox address ambiguous
545
+ '5.1.6' => Sisimai::Eb::ReMOVE, # Destination mailbox has moved, No forwarding address
546
+ '5.1.7' => Sisimai::Eb::ReFROM, # Bad sender's mailbox address syntax
547
+ '5.1.8' => Sisimai::Eb::ReFROM, # Bad sender's system address
548
+ '5.1.9' => Sisimai::Eb::RePROC, # Message relayed to non-compliant mailer
549
+ '5.1.10' => Sisimai::Eb::Re00MX, # Recipient address has null MX
550
+ '5.2.0' => Sisimai::Eb::ReFILT, # Other or undefined mailbox status
551
+ '5.2.1' => Sisimai::Eb::ReFILT, # Mailbox disabled, not accepting messages
552
+ '5.2.2' => Sisimai::Eb::ReFULL, # Mailbox full
553
+ '5.2.3' => Sisimai::Eb::ReSIZE, # Message length exceeds administrative limit
554
+ '5.2.4' => Sisimai::Eb::RePROC, # Mailing list expansion problem
555
+ '5.3.0' => Sisimai::Eb::RePROC, # Other or undefined mail system status
556
+ '5.3.1' => Sisimai::Eb::ReDISK, # Mail system full
557
+ '5.3.2' => Sisimai::Eb::Re00MX, # System not accepting network messages
558
+ '5.3.3' => Sisimai::Eb::RePROC, # System not capable of selected features
559
+ '5.3.4' => Sisimai::Eb::ReSIZE, # Message too big for system
560
+ '5.3.5' => Sisimai::Eb::RePROC, # System incorrectly configured
561
+ '5.4.0' => Sisimai::Eb::ReINET, # Other or undefined network or routing status
562
+ '5.4.3' => Sisimai::Eb::RePROC, # Directory server failure
563
+ '5.4.4' => Sisimai::Eb::ReHOST, # Unable to route
564
+ '5.5.2' => Sisimai::Eb::RePROC, # If the server cannot BASE64 decode any client response (AUTH)
565
+ '5.5.3' => Sisimai::Eb::ReRATE, # Too many recipients
566
+ '5.5.4' => Sisimai::Eb::RePROC, # Invalid command arguments
567
+ '5.5.5' => Sisimai::Eb::RePROC, # Wrong protocol version
568
+ '5.5.6' => Sisimai::Eb::ReCOMM, # Authentication Exchange line is too long
569
+ '5.6.0' => Sisimai::Eb::ReBODY, # Other or undefined media error
570
+ '5.6.1' => Sisimai::Eb::ReBODY, # Media not supported
571
+ '5.6.2' => Sisimai::Eb::ReBODY, # Conversion required and prohibited
572
+ '5.6.3' => Sisimai::Eb::ReBODY, # Conversion required but not supported
573
+ '5.6.5' => Sisimai::Eb::ReBODY, # Conversion Failed
574
+ '5.6.6' => Sisimai::Eb::ReBODY, # Message content not available
575
+ '5.6.7' => Sisimai::Eb::ReFROM, # Non-ASCII addresses not permitted for that sender/recipient
576
+ '5.6.8' => Sisimai::Eb::ReBODY, # UTF-8 string reply is required, but not permitted by the SMTP client
577
+ '5.6.9' => Sisimai::Eb::ReBODY, # UTF-8 header message cannot be transferred to one or more recipients
578
+ '5.7.0' => Sisimai::Eb::ReSAFE, # Other or undefined security status
579
+ '5.7.1' => Sisimai::Eb::ReSAFE, # Delivery not authorized, message refused
580
+ '5.7.2' => Sisimai::Eb::ReSAFE, # Mailing list expansion prohibited
581
+ '5.7.3' => Sisimai::Eb::ReSAFE, # Security conversion required but not possible
582
+ '5.7.4' => Sisimai::Eb::ReSAFE, # Security features not supported
583
+ '5.7.5' => Sisimai::Eb::ReSAFE, # Cryptographic failure
584
+ '5.7.6' => Sisimai::Eb::ReSAFE, # Cryptographic algorithm not supported
585
+ '5.7.7' => Sisimai::Eb::ReSAFE, # Message integrity failure
586
+ '5.7.8' => Sisimai::Eb::ReSAFE, # Authentication credentials invalid
587
+ '5.7.9' => Sisimai::Eb::ReSAFE, # Authentication mechanism is too weak
588
+ '5.7.10' => Sisimai::Eb::ReSAFE, # Encryption Needed
589
+ '5.7.11' => Sisimai::Eb::ReSAFE, # Encryption required for requested authentication mechanism
590
+ '5.7.13' => Sisimai::Eb::ReQUIT, # User Account Disabled
591
+ '5.7.14' => Sisimai::Eb::ReSAFE, # Trust relationship required
592
+ '5.7.15' => Sisimai::Eb::ReSAFE, # Priority Level is too low
593
+ '5.7.16' => Sisimai::Eb::ReSIZE, # Message is too big for the specified priority
594
+ '5.7.17' => Sisimai::Eb::ReMOVE, # Mailbox owner has changed
595
+ '5.7.18' => Sisimai::Eb::ReMOVE, # Domain owner has changed
596
+ '5.7.19' => Sisimai::Eb::RePROC, # RRVS test cannot be completed
597
+ '5.7.20' => Sisimai::Eb::ReAUTH, # No passing DKIM signature found
598
+ '5.7.21' => Sisimai::Eb::ReAUTH, # No acceptable DKIM signature found
599
+ '5.7.22' => Sisimai::Eb::ReAUTH, # No valid author-matched DKIM signature found
600
+ '5.7.23' => Sisimai::Eb::ReAUTH, # SPF validation failed
601
+ '5.7.24' => Sisimai::Eb::ReAUTH, # SPF validation error
602
+ '5.7.25' => Sisimai::Eb::ReQPTR, # Reverse DNS validation failed
603
+ '5.7.26' => Sisimai::Eb::ReAUTH, # Multiple authentication checks failed
604
+ '5.7.27' => Sisimai::Eb::Re00MX, # MX resource record of a destination host is Null MX: RFC7505
605
+ '5.7.28' => Sisimai::Eb::ReSPAM, # The message appears to be part of a mail flood of similar abusive messages.
606
+ '5.7.29' => Sisimai::Eb::ReAUTH, # This status code may be returned when a message fails ARC validation.
607
+ '5.7.30' => Sisimai::Eb::ReTTLS, # REQUIRETLS support required
601
608
  }.freeze
602
609
 
603
610
  InternalCode = {
604
- 'authfailure' => ['5.9.130', '4.9.130'],
605
- 'badreputation' => ['5.9.132', '4.9.132'],
606
- 'blocked' => ['5.9.134', '4.9.134'],
607
- 'contenterror' => ['5.9.160', '4.9.160'],
608
- 'emailtoolarge' => ['5.9.161', '4.9.161'],
609
- 'expired' => ['5.9.340', '4.9.340'],
610
- 'failedstarttls' => ['5.9.350', '4.9.350'],
611
- 'filtered' => ['5.9.210', '4.9.210'],
612
- 'hasmoved' => ['5.9.211', ''],
613
- 'hostunknown' => ['5.9.212', ''],
614
- 'mailboxfull' => ['5.9.220', '4.9.220'],
615
- 'mailererror' => ['5.9.230', '4.9.230'],
616
- 'networkerror' => ['5.9.341', '4.9.341'],
617
- 'norelaying' => ['5.9.214', '4.9.214'],
618
- 'notaccept' => ['5.9.215', '4.9.215'],
619
- 'notcompliantrfc' => ['5.9.162', '4.9.162'],
620
- 'onhold' => ['5.9.301', '4.9.301'],
621
- 'policyviolation' => ['5.9.371', '4.9.371'],
622
- 'ratelimited' => ['5.9.131', '4.9.131'],
623
- 'rejected' => ['5.9.110', '4.9.110'],
624
- 'requireptr' => ['5.9.133', '4.9.133'],
625
- 'securityerror' => ['5.9.370', '4.9.370'],
626
- 'spamdetected' => ['5.9.164', '4.9.164'],
627
- 'suppressed' => ['5.9.310', '4.9.310'],
628
- 'suspend' => ['5.9.221', '4.9.221'],
629
- 'syntaxerror' => ['5.9.351', '4.9.351'],
630
- 'systemerror' => ['5.9.231', '4.9.231'],
631
- 'systemfull' => ['5.9.232', '4.9.232'],
632
- 'undefined' => ['5.9.300', '4.9.300'],
633
- 'userunknown' => ['5.9.213', ''],
634
- 'virusdetected' => ['5.9.165', '4.9.165'],
611
+ Sisimai::Eb::ReAUTH => ['5.9.130', '4.9.130'],
612
+ Sisimai::Eb::ReFAMA => ['5.9.132', '4.9.132'],
613
+ Sisimai::Eb::ReBLOC => ['5.9.134', '4.9.134'],
614
+ Sisimai::Eb::ReBODY => ['5.9.160', '4.9.160'],
615
+ Sisimai::Eb::ReSIZE => ['5.9.161', '4.9.161'],
616
+ Sisimai::Eb::ReTIME => ['5.9.340', '4.9.340'],
617
+ Sisimai::Eb::ReTTLS => ['5.9.350', '4.9.350'],
618
+ Sisimai::Eb::ReFILT => ['5.9.210', '4.9.210'],
619
+ Sisimai::Eb::ReMOVE => ['5.9.211', ''],
620
+ Sisimai::Eb::ReHOST => ['5.9.212', ''],
621
+ Sisimai::Eb::ReFULL => ['5.9.220', '4.9.220'],
622
+ Sisimai::Eb::ReUNIX => ['5.9.230', '4.9.230'],
623
+ Sisimai::Eb::ReINET => ['5.9.341', '4.9.341'],
624
+ Sisimai::Eb::RePASS => ['5.9.214', '4.9.214'],
625
+ Sisimai::Eb::Re00MX => ['5.9.215', '4.9.215'],
626
+ Sisimai::Eb::ReNRFC => ['5.9.162', '4.9.162'],
627
+ Sisimai::Eb::Re___1 => ['5.9.301', '4.9.301'],
628
+ Sisimai::Eb::ReWONT => ['5.9.371', '4.9.371'],
629
+ Sisimai::Eb::ReRATE => ['5.9.131', '4.9.131'],
630
+ Sisimai::Eb::ReFROM => ['5.9.110', '4.9.110'],
631
+ Sisimai::Eb::ReQPTR => ['5.9.133', '4.9.133'],
632
+ Sisimai::Eb::ReSAFE => ['5.9.370', '4.9.370'],
633
+ Sisimai::Eb::ReSPAM => ['5.9.164', '4.9.164'],
634
+ Sisimai::Eb::ReSTOP => ['5.9.310', '4.9.310'],
635
+ Sisimai::Eb::ReQUIT => ['5.9.221', '4.9.221'],
636
+ Sisimai::Eb::ReCOMM => ['5.9.351', '4.9.351'],
637
+ Sisimai::Eb::RePROC => ['5.9.231', '4.9.231'],
638
+ Sisimai::Eb::ReDISK => ['5.9.232', '4.9.232'],
639
+ Sisimai::Eb::Re___0 => ['5.9.300', '4.9.300'],
640
+ Sisimai::Eb::ReUSER => ['5.9.213', ''],
641
+ Sisimai::Eb::ReEXEC => ['5.9.165', '4.9.165'],
635
642
  }.freeze
636
643
 
637
644
  # Convert from the reason string to the internal status code
@@ -680,12 +687,10 @@ module Sisimai
680
687
  def find(argv1 = nil, argv2 = '0')
681
688
  return "" if argv1.to_s.empty? || argv1.size < 7
682
689
 
683
- givenclass = argv2[0, 1]
684
- eestatuses = if givenclass == '2' || givenclass == '4' || givenclass == '5'
685
- [givenclass + '.']
686
- else
687
- ['5.', '4.', '2.']
688
- end
690
+ case argv2[0, 1]
691
+ when '2', '4', '5' then eestatuses = [argv2[0, 1] + '.']
692
+ else eestatuses = ['5.', '4.', '2.']
693
+ end
689
694
  esmtperror = ' ' + argv1 + ' ' # Why 3 space characters? see https://github.com/sisimai/p5-sisimai/issues/574
690
695
  lookingfor = []
691
696
 
@@ -822,22 +827,22 @@ module Sisimai
822
827
  end
823
828
 
824
829
  return statuscode if zeroindex2['error'] > 0 # An SMTP status code is "X.0.0"
825
- return codeinmesg if statuscode == '4.4.7' # "4.4.7" is an ambiguous code
826
- return codeinmesg if statuscode == '4.7.0' # "4.7.0" indicates "too many errors"
827
830
  return codeinmesg if statuscode.start_with?('5.3.') # "5.3.Z" is an error of a system
828
- return codeinmesg if statuscode.end_with?('.5.1') # "X.5.1" indicates an invalid command
829
- return codeinmesg if statuscode.end_with?('.5.2') # "X.5.2" indicates a syntax error
830
- return codeinmesg if statuscode.end_with?('.5.4') # "X.5.4" indicates an invalid command arguments
831
- return codeinmesg if statuscode.end_with?('.5.5') # "X.5.5" indicates a wrong protocol version
832
-
833
- if statuscode == '5.1.1'
834
- # "5.1.1" is a code of "userunknown"
831
+ return codeinmesg if statuscode.end_with?('.5.1', '.5.2', '.5.4', '.5.5')
832
+
833
+ case statuscode
834
+ # - "4.4.7" is an ambigous code
835
+ # - "4.7.0" indicates "too many errors"
836
+ # - "X.5.1" indicates an invalid command
837
+ # - "X.5.2" indicates a syntax error
838
+ # - "X.5.4" indicates an invalid command argument
839
+ # - "X.5.5" indicates a wrong protocol version
840
+ when "4.4.7", "4.7.0" then return codeinmesg
841
+ when "5.1.3" then return codeinmesg if codeinmesg.start_with?('5.7.')
842
+ when "5.1.1"
843
+ # "5.1.1" is a code of "UserUnknown"
835
844
  return statuscode if codeinmesg.start_with?('5.5.') || zeroindex1['error'] > 0
836
845
  return codeinmesg
837
-
838
- elsif statuscode == '5.1.3'
839
- # "5.1.3"
840
- return codeinmesg if codeinmesg.start_with?('5.7.')
841
846
  end
842
847
 
843
848
  return statuscode
@@ -3,6 +3,7 @@ module Sisimai
3
3
  # Sisimai::SMTP::Transcript is a decoder for the transcript logs of the SMTP session
4
4
  module Transcript
5
5
  class << self
6
+ require 'sisimai/eb'
6
7
  require 'sisimai/smtp/reply'
7
8
  require 'sisimai/smtp/status'
8
9
 
@@ -43,7 +44,7 @@ module Sisimai
43
44
  # An SMTP server response starting with '<<<' is the first
44
45
  esmtp << table.call
45
46
  cx = esmtp[-1]
46
- cx['command'] = 'CONN'
47
+ cx['command'] = Sisimai::Eb::CeCONN
47
48
  argv0 = argv0[p2, argv0.size] if p2 > -1
48
49
  else
49
50
  # An SMTP command starting with '>>>' is the first
@@ -68,7 +69,7 @@ module Sisimai
68
69
  cx = esmtp[-1]
69
70
  cx['command'] = thecommand.upcase
70
71
 
71
- if thecommand =~ /\A(?:MAIL|RCPT|XFORWARD)/
72
+ if thecommand == Sisimai::Eb::CeMAIL || thecommand == Sisimai::Eb::CeRCPT || thecommand == Sisimai::Eb::CeXFWD
72
73
  # MAIL or RCPT
73
74
  if cv = commandarg.match(/\A(?:FROM|TO):[ ]*<(.+[@].+)>[ ]*(.*)\z/)
74
75
  # >>> MAIL FROM: <neko@example.com> SIZE=65535
@@ -17,18 +17,6 @@ module Sisimai
17
17
  return false
18
18
  end
19
19
 
20
- # Clean the string out
21
- # @param [String] argv1 String to be cleaned
22
- # @return [String] Cleaned out string
23
- # @example Clean up text
24
- # sweep(' neko ') #=> 'neko'
25
- def sweep(argv1)
26
- return argv1 if argv1.is_a?(::String) == false
27
- argv1 = argv1.chomp.squeeze(' ').strip
28
- argv1 = argv1.sub(/ [-]{2,}[^ ].+\z/, '')
29
- return argv1
30
- end
31
-
32
20
  # Check if each element of the 2nd argument is aligned in the 1st argument or not
33
21
  # @param [String] argv1 String to be checked
34
22
  # @param [Array] argv2 List including the ordered strings
@@ -1,4 +1,4 @@
1
1
  # Define the version number of Sisimai
2
2
  module Sisimai
3
- VERSION = '5.6.0'.freeze
3
+ VERSION = '5.7.1'.freeze
4
4
  end
data/lib/sisimai.rb CHANGED
@@ -104,12 +104,13 @@ module Sisimai
104
104
  # Reason list Sisimai can detect
105
105
  # @return [Hash] Reason list table
106
106
  def reason
107
+ require 'sisimai/eb'
107
108
  require 'sisimai/reason'
108
109
  table = {}
109
110
  names = Sisimai::Reason.index
110
111
 
111
112
  # These reasons are not included in the results of Sisimai::Reason.index
112
- names += %w[Delivered Feedback Undefined Vacation]
113
+ names += [Sisimai::Eb::ReSENT, Sisimai::Eb::ReFEED, Sisimai::Eb::Re___0, Sisimai::Eb::ReAWAY]
113
114
  while e = names.shift do
114
115
  # Call .description() method of Sisimai::Reason::*
115
116
  r = "Sisimai::Reason::#{e}"
@@ -0,0 +1,66 @@
1
+ Received-SPF: None (no SPF record) identity=helo; client-ip=192.0.2.1; helo=mailout11.t-online.de; envelope-from=<>; receiver=mail.example.com
2
+ Received: from mailout11.t-online.de (mailout11.t-online.de [192.0.2.1])
3
+ by mail.example.com (Postfix) with ESMTPS id 2A29623F0
4
+ for <returnpath@mail.example.com>; Wed, 03 Jun 2026 17:30:52 +0000 (UTC)
5
+ Received: from mailin42.aul.t-online.de (mailin42.aul.t-online.de [192.51.100.1])
6
+ by mailout11.t-online.de (Postfix) with SMTP id 05E5A1CAC0
7
+ for <returnpath@mail.example.com>; Wed, 3 Jun 2026 19:23:42 +0200 (CEST)
8
+ X-Failed-Recipients: example@t-online.de
9
+ From: Mail Delivery System <Mailer-Daemon@t-online.de>
10
+ To: returnpath@mail.example.com
11
+ Subject: Mail delivery failed: returning message to sender
12
+ Message-Id: <xxxyyyzzzaaabbccc.aul.t-online.de>
13
+ Date: Wed, 3 Jun 2026 19:23:17 +0200
14
+ X-TOI-MSGID: c9412855-531f-497b-b007-5ffc033877a0
15
+ Authentication-Results: mailin42.aul.t-online.de; dkim=none;
16
+ dkim-atps=neutral
17
+
18
+ |------------------------- Failed addresses follow: ---------------------|
19
+ <example@t-online.de>
20
+ 552 5.2.2 <example@t-online.de> Quota exceeded (mailbox for user is full)
21
+
22
+ |------------------------- Message header follows: ----------------------|
23
+ Received: from mail.example.com ([152.53.207.210]) by mailin42.t-online.de
24
+ with (TLSv1.3:TLS_AES_256_GCM_SHA384 encrypted)
25
+ esmtp id 1wUpJD-0ZWsnR0; Wed, 3 Jun 2026 19:23:15 +0200
26
+ Received: by mail.example.com (Postfix)
27
+ id AD20B29490; Tue, 02 Jun 2026 20:17:41 +0000 (UTC)
28
+ Date: Tue, 02 Jun 2026 20:17:41 +0000
29
+ From: some corp <somecorp@example.com>
30
+ Reply-To: some corp <somecorp@example.com>
31
+ To: example@t-online.de
32
+ Message-ID: <outgoingmessageid>
33
+ Subject: Subject omitted for privacy
34
+ Mime-Version: 1.0
35
+ Content-Type: multipart/mixed;
36
+ boundary="--==_mimepart_6a1f3a659c89f_79afe920227275f";
37
+ charset=UTF-8
38
+ Content-Transfer-Encoding: 7bit
39
+
40
+ |----------- Message text follows: (body too large, truncated) ----------|
41
+
42
+ ----==_mimepart_6a1f3a659c89f_79afe920227275f
43
+ Content-Type: text/html;
44
+ charset=UTF-8
45
+ Content-Transfer-Encoding: quoted-printable
46
+
47
+ <!DOCTYPE html>
48
+ <html>
49
+ <head>
50
+ <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type">=
51
+
52
+ <style>
53
+ #footer {
54
+ font-size: 11px;
55
+ border-top: 1px solid #666;
56
+ color: #333;
57
+ margin-top: 1em;
58
+ padding-top: 1em;
59
+ }
60
+ </style>
61
+
62
+ </head>
63
+ <body>
64
+ <p>Hello there, fellow some corp user!</p><p>I would like to inform you a=
65
+ about the upcoming team event next we
66
+
@@ -0,0 +1,68 @@
1
+ Received-SPF: None (no SPF record) identity=helo; client-ip=192.0.2.1; helo=mailout11.t-online.de; envelope-from=<>; receiver=mail.example.com
2
+ Received: from mailout11.t-online.de (mailout11.t-online.de [192.0.2.1])
3
+ by mail.example.com (Postfix) with ESMTPS id 2A29623F0
4
+ for <returnpath@mail.example.com>; Wed, 03 Jun 2026 17:30:52 +0000 (UTC)
5
+ Received: from mailin42.aul.t-online.de (mailin42.aul.t-online.de [192.51.100.1])
6
+ by mailout11.t-online.de (Postfix) with SMTP id 05E5A1CAC0
7
+ for <returnpath@mail.example.com>; Wed, 3 Jun 2026 19:23:42 +0200 (CEST)
8
+ X-Failed-Recipients: example@t-online.de
9
+ From: Mail Delivery System <Mailer-Daemon@t-online.de>
10
+ To: returnpath@mail.example.com
11
+ Subject: Mail delivery failed: returning message to sender
12
+ Message-Id: <xxxyyyzzzaaabbccc.aul.t-online.de>
13
+ Date: Wed, 3 Jun 2026 19:23:17 +0200
14
+ X-TOI-MSGID: c9412855-531f-497b-b007-5ffc033877a0
15
+ Authentication-Results: mailin42.aul.t-online.de; dkim=none;
16
+ dkim-atps=neutral
17
+
18
+ |------------------------- Failed addresses follow: ---------------------|
19
+ <example1@t-online.de>
20
+ 552 5.2.2 <example1@t-online.de> Quota exceeded (mailbox for user is full)
21
+ <example2@t-online.de>
22
+ 550 5.1.1 <example2@t-online.de> unknown user
23
+
24
+ |------------------------- Message header follows: ----------------------|
25
+ Received: from mail.example.com ([152.53.207.210]) by mailin42.t-online.de
26
+ with (TLSv1.3:TLS_AES_256_GCM_SHA384 encrypted)
27
+ esmtp id 1wUpJD-0ZWsnR0; Wed, 3 Jun 2026 19:23:15 +0200
28
+ Received: by mail.example.com (Postfix)
29
+ id AD20B29490; Tue, 02 Jun 2026 20:17:41 +0000 (UTC)
30
+ Date: Tue, 02 Jun 2026 20:17:41 +0000
31
+ From: some corp <somecorp@example.com>
32
+ Reply-To: some corp <somecorp@example.com>
33
+ To: <example1@t-online.de>, <example2@t-online.de>
34
+ Message-ID: <outgoingmessageid>
35
+ Subject: Subject omitted for privacy
36
+ Mime-Version: 1.0
37
+ Content-Type: multipart/mixed;
38
+ boundary="--==_mimepart_6a1f3a659c89f_79afe920227275f";
39
+ charset=UTF-8
40
+ Content-Transfer-Encoding: 7bit
41
+
42
+ |----------- Message text follows: (body too large, truncated) ----------|
43
+
44
+ ----==_mimepart_6a1f3a659c89f_79afe920227275f
45
+ Content-Type: text/html;
46
+ charset=UTF-8
47
+ Content-Transfer-Encoding: quoted-printable
48
+
49
+ <!DOCTYPE html>
50
+ <html>
51
+ <head>
52
+ <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type">=
53
+
54
+ <style>
55
+ #footer {
56
+ font-size: 11px;
57
+ border-top: 1px solid #666;
58
+ color: #333;
59
+ margin-top: 1em;
60
+ padding-top: 1em;
61
+ }
62
+ </style>
63
+
64
+ </head>
65
+ <body>
66
+ <p>Hello there, fellow some corp user!</p><p>I would like to inform you a=
67
+ about the upcoming team event next we
68
+