sisimai 5.5.0-java → 5.7.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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake-test.yml +0 -4
  3. data/ChangeLog.md +53 -0
  4. data/LICENSE +1 -1
  5. data/README-JA.md +26 -20
  6. data/README.md +30 -25
  7. data/lib/sisimai/address.rb +8 -31
  8. data/lib/sisimai/arf.rb +3 -5
  9. data/lib/sisimai/fact.rb +26 -36
  10. data/lib/sisimai/lhost/activehunter.rb +0 -2
  11. data/lib/sisimai/lhost/amazonses.rb +7 -9
  12. data/lib/sisimai/lhost/apachejames.rb +0 -1
  13. data/lib/sisimai/lhost/biglobe.rb +0 -16
  14. data/lib/sisimai/lhost/courier.rb +5 -4
  15. data/lib/sisimai/lhost/deutschetelekom.rb +120 -0
  16. data/lib/sisimai/lhost/domino.rb +0 -3
  17. data/lib/sisimai/lhost/dragonfly.rb +0 -27
  18. data/lib/sisimai/lhost/einsundeins.rb +1 -10
  19. data/lib/sisimai/lhost/exchange2003.rb +4 -4
  20. data/lib/sisimai/lhost/exchange2007.rb +5 -6
  21. data/lib/sisimai/lhost/exim.rb +35 -85
  22. data/lib/sisimai/lhost/ezweb.rb +12 -49
  23. data/lib/sisimai/lhost/fml.rb +4 -29
  24. data/lib/sisimai/lhost/gmail.rb +0 -23
  25. data/lib/sisimai/lhost/gmx.rb +7 -24
  26. data/lib/sisimai/lhost/googlegroups.rb +3 -3
  27. data/lib/sisimai/lhost/googleworkspace.rb +0 -4
  28. data/lib/sisimai/lhost/imailserver.rb +3 -9
  29. data/lib/sisimai/lhost/kddi.rb +6 -20
  30. data/lib/sisimai/lhost/mailfoundry.rb +0 -2
  31. data/lib/sisimai/lhost/mailmarshal.rb +1 -3
  32. data/lib/sisimai/lhost/messagingserver.rb +4 -15
  33. data/lib/sisimai/lhost/mfilter.rb +0 -1
  34. data/lib/sisimai/lhost/mimecast.rb +0 -1
  35. data/lib/sisimai/lhost/notes.rb +1 -2
  36. data/lib/sisimai/lhost/opensmtpd.rb +0 -40
  37. data/lib/sisimai/lhost/postfix.rb +10 -11
  38. data/lib/sisimai/lhost/qmail.rb +14 -81
  39. data/lib/sisimai/lhost/sendmail.rb +4 -4
  40. data/lib/sisimai/lhost/trendmicro.rb +3 -3
  41. data/lib/sisimai/lhost/v5sendmail.rb +0 -1
  42. data/lib/sisimai/lhost/verizon.rb +1 -2
  43. data/lib/sisimai/lhost/x1.rb +1 -2
  44. data/lib/sisimai/lhost/x2.rb +0 -2
  45. data/lib/sisimai/lhost/x3.rb +4 -9
  46. data/lib/sisimai/lhost/x6.rb +0 -1
  47. data/lib/sisimai/lhost/zoho.rb +0 -12
  48. data/lib/sisimai/lhost.rb +38 -19
  49. data/lib/sisimai/message.rb +3 -1
  50. data/lib/sisimai/order.rb +4 -1
  51. data/lib/sisimai/reason/authfailure.rb +9 -13
  52. data/lib/sisimai/reason/badreputation.rb +7 -7
  53. data/lib/sisimai/reason/blocked.rb +57 -83
  54. data/lib/sisimai/reason/contenterror.rb +16 -8
  55. data/lib/sisimai/reason/{mesgtoobig.rb → emailtoolarge.rb} +22 -25
  56. data/lib/sisimai/reason/expired.rb +27 -23
  57. data/lib/sisimai/reason/filtered.rb +13 -17
  58. data/lib/sisimai/reason/hasmoved.rb +2 -1
  59. data/lib/sisimai/reason/hostunknown.rb +25 -19
  60. data/lib/sisimai/reason/mailboxfull.rb +28 -49
  61. data/lib/sisimai/reason/networkerror.rb +28 -16
  62. data/lib/sisimai/reason/norelaying.rb +21 -20
  63. data/lib/sisimai/reason/notaccept.rb +13 -8
  64. data/lib/sisimai/reason/notcompliantrfc.rb +6 -9
  65. data/lib/sisimai/reason/policyviolation.rb +17 -26
  66. data/lib/sisimai/reason/ratelimited.rb +62 -0
  67. data/lib/sisimai/reason/rejected.rb +51 -59
  68. data/lib/sisimai/reason/requireptr.rb +13 -25
  69. data/lib/sisimai/reason/securityerror.rb +14 -19
  70. data/lib/sisimai/reason/spamdetected.rb +51 -101
  71. data/lib/sisimai/reason/suspend.rb +30 -24
  72. data/lib/sisimai/reason/syntaxerror.rb +1 -8
  73. data/lib/sisimai/reason/systemerror.rb +37 -23
  74. data/lib/sisimai/reason/systemfull.rb +1 -1
  75. data/lib/sisimai/reason/userunknown.rb +81 -112
  76. data/lib/sisimai/reason/virusdetected.rb +6 -8
  77. data/lib/sisimai/reason.rb +15 -15
  78. data/lib/sisimai/rfc1123.rb +1 -1
  79. data/lib/sisimai/rfc1894.rb +7 -6
  80. data/lib/sisimai/rfc2045.rb +2 -2
  81. data/lib/sisimai/rfc3464/thirdparty.rb +1 -1
  82. data/lib/sisimai/rfc3464.rb +10 -14
  83. data/lib/sisimai/rfc3834.rb +3 -4
  84. data/lib/sisimai/rfc791.rb +3 -38
  85. data/lib/sisimai/rhost/apple.rb +5 -5
  86. data/lib/sisimai/rhost/cloudflare.rb +2 -0
  87. data/lib/sisimai/rhost/cox.rb +22 -20
  88. data/lib/sisimai/rhost/facebook.rb +16 -16
  89. data/lib/sisimai/rhost/franceptt.rb +8 -3
  90. data/lib/sisimai/rhost/godaddy.rb +33 -15
  91. data/lib/sisimai/rhost/google.rb +63 -64
  92. data/lib/sisimai/rhost/iua.rb +1 -1
  93. data/lib/sisimai/rhost/messagelabs.rb +12 -12
  94. data/lib/sisimai/rhost/microsoft.rb +86 -86
  95. data/lib/sisimai/rhost/mimecast.rb +34 -34
  96. data/lib/sisimai/rhost/nttdocomo.rb +2 -2
  97. data/lib/sisimai/rhost/spectrum.rb +7 -7
  98. data/lib/sisimai/rhost/tencent.rb +9 -11
  99. data/lib/sisimai/rhost/yahooinc.rb +7 -8
  100. data/lib/sisimai/rhost.rb +1 -1
  101. data/lib/sisimai/smtp/command.rb +2 -0
  102. data/lib/sisimai/smtp/status.rb +73 -109
  103. data/lib/sisimai/string.rb +0 -27
  104. data/lib/sisimai/version.rb +1 -1
  105. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-01.eml +66 -0
  106. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-02.eml +68 -0
  107. data/set-of-emails/maildir/bsd/lhost-deutschetelekom-03.eml +50 -0
  108. data/set-of-emails/should-not-crash/p5-664-iomart-mail-filter.eml +258 -0
  109. data/set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet/.gitkeep +0 -0
  110. metadata +10 -6
  111. data/lib/sisimai/reason/exceedlimit.rb +0 -47
  112. data/lib/sisimai/reason/speeding.rb +0 -47
  113. data/lib/sisimai/reason/toomanyconn.rb +0 -59
@@ -31,6 +31,13 @@ module Sisimai
31
31
  # See https://postmaster.yahooinc.com/error-codes
32
32
  'not accepted for policy reasons',
33
33
  ],
34
+ 'ratelimited' => [
35
+ # - 421 Max message per connection reached, closing transmission channel
36
+ 'max message per connection reached',
37
+
38
+ # - 450 User is receiving mail too quickly
39
+ 'user is receiving mail too quickly',
40
+ ],
34
41
  'rejected' => [
35
42
  # Observed the following error message since around March 2024:
36
43
  #
@@ -53,10 +60,6 @@ module Sisimai
53
60
  # Retrying will NOT succeed. See https://postmaster.yahooinc.com/error-codes
54
61
  ' will be permanently deferred',
55
62
  ],
56
- 'speeding' => [
57
- # - 450 User is receiving mail too quickly
58
- 'user is receiving mail too quickly',
59
- ],
60
63
  'suspend' => [
61
64
  # - 554 delivery error: dd ****@yahoo.com is no longer valid.
62
65
  # - 554 30 Sorry, your message to *****@aol.jp cannot be delivered.
@@ -68,10 +71,6 @@ module Sisimai
68
71
  # - 501 Syntax error in parameters or arguments
69
72
  'syntax error in parameters or arguments',
70
73
  ],
71
- 'toomanyconn' => [
72
- # - 421 Max message per connection reached, closing transmission channel
73
- 'max message per connection reached',
74
- ],
75
74
  'userunknown' => [
76
75
  # - 554 delivery error: dd This user doesn't have a yahoo.com account (***@yahoo.com)
77
76
  # - 552 1 Requested mail action aborted, mailbox not found (in reply to end of DATA command)
data/lib/sisimai/rhost.rb CHANGED
@@ -24,7 +24,7 @@ module Sisimai
24
24
  "Spectrum" => ["charter.net"],
25
25
  "Tencent" => [".qq.com"],
26
26
  "YahooInc" => [".yahoodns.net"],
27
- "Zoho" => [".zoho.com", ".zoho.eu"],
27
+ "Zoho" => [".zoho.com", ".zoho.eu", ".zoho.jp", ".zoho.com.au", ".zoho.com.cn", ".zoho.in"],
28
28
  }.freeze
29
29
 
30
30
  # Returns the rhost class name
@@ -2,6 +2,8 @@ module Sisimai
2
2
  module SMTP
3
3
  # Sisimai::SMTP::Transcript is an SMTP Command related utilities
4
4
  module Command
5
+ ExceptDATA = ["CONN", "EHLO", "HELO", "MAIL", "RCPT"].freeze
6
+ BeforeRCPT = ["CONN", "EHLO", "EHLO", "MAIL", "AUTH", "STARTTLS"].freeze
5
7
  class << self
6
8
  Availables = [
7
9
  "HELO", "EHLO", "MAIL", "RCPT", "DATA", "QUIT", "RSET", "NOOP", "VRFY", "ETRN", "EXPN",
@@ -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
@@ -494,10 +500,10 @@ module Sisimai
494
500
  '4.1.7' => 'rejected', # Bad sender's mailbox address syntax
495
501
  '4.1.8' => 'rejected', # Bad sender's system address
496
502
  '4.1.9' => 'systemerror', # Message relayed to non-compliant mailer
497
- '4.2.1' => 'blocked', # Mailbox disabled, not accepting messages
503
+ '4.2.1' => 'suspend', # Mailbox disabled, not accepting messages
498
504
  '4.2.2' => 'mailboxfull', # Mailbox full
499
- '4.2.3' => 'exceedlimit', # Message length exceeds administrative limit
500
- '4.2.4' => 'filtered', # Mailing list expansion problem
505
+ '4.2.3' => 'emailtoolarge', # Message length exceeds administrative limit
506
+ '4.2.4' => 'systemerror', # Mailing list expansion problem
501
507
  # '4.3.0' => 'systemerror', # Other or undefined mail system status
502
508
  '4.3.1' => 'systemfull', # Mail system full
503
509
  '4.3.2' => 'notaccept', # System not accepting network messages
@@ -513,20 +519,20 @@ module Sisimai
513
519
  '4.4.7' => 'expired', # Delivery time expired
514
520
  '4.4.8' => 'networkerror', # Retry on IPv4
515
521
  # '4.5.0' => 'networkerror', # Other or undefined protocol status
516
- '4.5.3' => 'systemerror', # Too many recipients
522
+ '4.5.3' => 'ratelimited', # Too many recipients
517
523
  '4.5.5' => 'systemerror', # Wrong protocol version
518
524
  '4.6.0' => 'contenterror', # Other or undefined media error
519
525
  '4.6.2' => 'contenterror', # Conversion required and prohibited
520
526
  '4.6.5' => 'contenterror', # Conversion Failed
521
527
  # :'4.7.0' => 'securityerror', # Other or undefined security status
522
528
  '4.7.1' => 'blocked', # Delivery not authorized, message refused
523
- '4.7.2' => 'blocked', # Mailing list expansion prohibited
529
+ '4.7.2' => 'rejected', # Mailing list expansion prohibited
524
530
  '4.7.5' => 'securityerror', # Cryptographic failure
525
531
  '4.7.6' => 'securityerror', # Cryptographic algorithm not supported
526
532
  '4.7.7' => 'securityerror', # Message integrity failure
527
533
  '4.7.12' => 'securityerror', # A password transition is needed
528
534
  '4.7.15' => 'securityerror', # Priority Level is too low
529
- '4.7.16' => 'mesgtoobig', # Message is too big for the specified priority
535
+ '4.7.16' => 'emailtoolarge', # Message is too big for the specified priority
530
536
  '4.7.24' => 'authfailure ', # SPF validation error
531
537
  '4.7.25' => 'requireptr', # Reverse DNS validation failed
532
538
  # ---------------------------------------------------------------------------------------
@@ -543,19 +549,19 @@ module Sisimai
543
549
  '5.2.0' => 'filtered', # Other or undefined mailbox status
544
550
  '5.2.1' => 'filtered', # Mailbox disabled, not accepting messages
545
551
  '5.2.2' => 'mailboxfull', # Mailbox full
546
- '5.2.3' => 'exceedlimit', # Message length exceeds administrative limit
547
- '5.2.4' => 'filtered', # Mailing list expansion problem
552
+ '5.2.3' => 'emailtoolarge', # Message length exceeds administrative limit
553
+ '5.2.4' => 'systemerror', # Mailing list expansion problem
548
554
  '5.3.0' => 'systemerror', # Other or undefined mail system status
549
555
  '5.3.1' => 'systemfull', # Mail system full
550
556
  '5.3.2' => 'notaccept', # System not accepting network messages
551
557
  '5.3.3' => 'systemerror', # System not capable of selected features
552
- '5.3.4' => 'mesgtoobig', # Message too big for system
558
+ '5.3.4' => 'emailtoolarge', # Message too big for system
553
559
  '5.3.5' => 'systemerror', # System incorrectly configured
554
560
  '5.4.0' => 'networkerror', # Other or undefined network or routing status
555
561
  '5.4.3' => 'systemerror', # Directory server failure
556
562
  '5.4.4' => 'hostunknown', # Unable to route
557
563
  '5.5.2' => 'systemerror', # If the server cannot BASE64 decode any client response (AUTH)
558
- '5.5.3' => 'toomanyconn', # Too many recipients
564
+ '5.5.3' => 'ratelimited', # Too many recipients
559
565
  '5.5.4' => 'systemerror', # Invalid command arguments
560
566
  '5.5.5' => 'systemerror', # Wrong protocol version
561
567
  '5.5.6' => 'syntaxerror', # Authentication Exchange line is too long
@@ -565,7 +571,7 @@ module Sisimai
565
571
  '5.6.3' => 'contenterror', # Conversion required but not supported
566
572
  '5.6.5' => 'contenterror', # Conversion Failed
567
573
  '5.6.6' => 'contenterror', # Message content not available
568
- '5.6.7' => 'contenterror', # Non-ASCII addresses not permitted for that sender/recipient
574
+ '5.6.7' => 'rejected', # Non-ASCII addresses not permitted for that sender/recipient
569
575
  '5.6.8' => 'contenterror', # UTF-8 string reply is required, but not permitted by the SMTP client
570
576
  '5.6.9' => 'contenterror', # UTF-8 header message cannot be transferred to one or more recipients
571
577
  '5.7.0' => 'securityerror', # Other or undefined security status
@@ -583,10 +589,10 @@ module Sisimai
583
589
  '5.7.13' => 'suspend', # User Account Disabled
584
590
  '5.7.14' => 'securityerror', # Trust relationship required
585
591
  '5.7.15' => 'securityerror', # Priority Level is too low
586
- '5.7.16' => 'mesgtoobig', # Message is too big for the specified priority
592
+ '5.7.16' => 'emailtoolarge', # Message is too big for the specified priority
587
593
  '5.7.17' => 'hasmoved', # Mailbox owner has changed
588
594
  '5.7.18' => 'hasmoved', # Domain owner has changed
589
- '5.7.19' => 'securityerror', # RRVS test cannot be completed
595
+ '5.7.19' => 'systemerror', # RRVS test cannot be completed
590
596
  '5.7.20' => 'authfailure', # No passing DKIM signature found
591
597
  '5.7.21' => 'authfailure', # No acceptable DKIM signature found
592
598
  '5.7.22' => 'authfailure', # No valid author-matched DKIM signature found
@@ -601,76 +607,37 @@ module Sisimai
601
607
  }.freeze
602
608
 
603
609
  InternalCode = {
604
- :temporary => {
605
- 'authfailure' => '4.0.926',
606
- 'badreputation' => '4.0.975',
607
- 'blocked' => '4.0.971',
608
- 'contenterror' => '4.0.960',
609
- 'exceedlimit' => '4.0.923',
610
- 'expired' => '4.0.947',
611
- 'failedstarttls' => '4.0.976',
612
- 'filtered' => '4.0.924',
613
- # 'hasmoved' => '4.0.916',
614
- # 'hostunknown' => '4.0.912',
615
- 'mailboxfull' => '4.0.922',
616
- 'mailererror' => '4.0.939',
617
- 'mesgtoobig' => '4.0.934',
618
- 'networkerror' => '4.0.944',
619
- 'norelaying' => '4.0.909',
620
- 'notaccept' => '4.0.932',
621
- 'notcompliantrfc' => '4.0.974',
622
- 'onhold' => '4.0.901',
623
- 'policyviolaton' => '4.0.972',
624
- 'rejected' => '4.0.918',
625
- 'requireptr' => '4.0.973',
626
- 'securityerror' => '4.0.970',
627
- 'spamdetected' => '4.0.980',
628
- 'speeding' => '4.0.946',
629
- 'suppressed' => '4.0.903',
630
- 'suspend' => '4.0.921',
631
- 'systemerror' => '4.0.930',
632
- 'systemfull' => '4.0.931',
633
- 'syntaxerror' => '4.0.902',
634
- 'toomanyconn' => '4.0.945',
635
- # 'userunknown' => '4.0.911',
636
- 'undefined' => '4.0.900',
637
- 'virusdetected' => '4.0.981',
638
- },
639
- :permanent => {
640
- 'authfailure' => '5.0.926',
641
- 'badreputation' => '5.0.975',
642
- 'blocked' => '5.0.971',
643
- 'contenterror' => '5.0.960',
644
- 'exceedlimit' => '5.0.923',
645
- 'expired' => '5.0.947',
646
- 'failedstarttls' => '5.0.976',
647
- 'filtered' => '5.0.910',
648
- 'hasmoved' => '5.0.916',
649
- 'hostunknown' => '5.0.912',
650
- 'mailboxfull' => '5.0.922',
651
- 'mailererror' => '5.0.939',
652
- 'mesgtoobig' => '5.0.934',
653
- 'networkerror' => '5.0.944',
654
- 'norelaying' => '5.0.909',
655
- 'notaccept' => '5.0.932',
656
- 'notcompliantrfc' => '5.0.974',
657
- 'onhold' => '5.0.901',
658
- 'policyviolation' => '5.0.972',
659
- 'rejected' => '5.0.918',
660
- 'requireptr' => '5.0.973',
661
- 'securityerror' => '5.0.970',
662
- 'spamdetected' => '5.0.980',
663
- 'speeding' => '5.0.946',
664
- 'suppressed' => '5.0.903',
665
- 'suspend' => '5.0.921',
666
- 'systemerror' => '5.0.930',
667
- 'systemfull' => '5.0.931',
668
- 'syntaxerror' => '5.0.902',
669
- 'toomanyconn' => '5.0.945',
670
- 'userunknown' => '5.0.911',
671
- 'undefined' => '5.0.900',
672
- 'virusdetected' => '5.0.981',
673
- },
610
+ 'authfailure' => ['5.9.130', '4.9.130'],
611
+ 'badreputation' => ['5.9.132', '4.9.132'],
612
+ 'blocked' => ['5.9.134', '4.9.134'],
613
+ 'contenterror' => ['5.9.160', '4.9.160'],
614
+ 'emailtoolarge' => ['5.9.161', '4.9.161'],
615
+ 'expired' => ['5.9.340', '4.9.340'],
616
+ 'failedstarttls' => ['5.9.350', '4.9.350'],
617
+ 'filtered' => ['5.9.210', '4.9.210'],
618
+ 'hasmoved' => ['5.9.211', ''],
619
+ 'hostunknown' => ['5.9.212', ''],
620
+ 'mailboxfull' => ['5.9.220', '4.9.220'],
621
+ 'mailererror' => ['5.9.230', '4.9.230'],
622
+ 'networkerror' => ['5.9.341', '4.9.341'],
623
+ 'norelaying' => ['5.9.214', '4.9.214'],
624
+ 'notaccept' => ['5.9.215', '4.9.215'],
625
+ 'notcompliantrfc' => ['5.9.162', '4.9.162'],
626
+ 'onhold' => ['5.9.301', '4.9.301'],
627
+ 'policyviolation' => ['5.9.371', '4.9.371'],
628
+ 'ratelimited' => ['5.9.131', '4.9.131'],
629
+ 'rejected' => ['5.9.110', '4.9.110'],
630
+ 'requireptr' => ['5.9.133', '4.9.133'],
631
+ 'securityerror' => ['5.9.370', '4.9.370'],
632
+ 'spamdetected' => ['5.9.164', '4.9.164'],
633
+ 'suppressed' => ['5.9.310', '4.9.310'],
634
+ 'suspend' => ['5.9.221', '4.9.221'],
635
+ 'syntaxerror' => ['5.9.351', '4.9.351'],
636
+ 'systemerror' => ['5.9.231', '4.9.231'],
637
+ 'systemfull' => ['5.9.232', '4.9.232'],
638
+ 'undefined' => ['5.9.300', '4.9.300'],
639
+ 'userunknown' => ['5.9.213', ''],
640
+ 'virusdetected' => ['5.9.165', '4.9.165'],
674
641
  }.freeze
675
642
 
676
643
  # Convert from the reason string to the internal status code
@@ -679,12 +646,11 @@ module Sisimai
679
646
  # true: Temporary error
680
647
  # @return [String] DSN or an empty string if the 1st argument is missing
681
648
  # @see name
682
- def code(argv1 = nil, argv2 = false)
683
- return "" if argv1.to_s.empty?
649
+ def code(argv1 = "", argv2 = false)
650
+ return "" if argv1.empty?
684
651
 
685
- table = argv2 ? InternalCode[:temporary] : InternalCode[:permanent]
686
- code0 = table[argv1] || InternalCode[:permanent][argv1] || nil
687
- return code0
652
+ pairs = InternalCode[argv1]; return "" if pairs.nil?
653
+ return argv2 ? pairs[1] : pairs[0]
688
654
  end
689
655
 
690
656
  # Convert from the status code to the reason string
@@ -720,12 +686,10 @@ module Sisimai
720
686
  def find(argv1 = nil, argv2 = '0')
721
687
  return "" if argv1.to_s.empty? || argv1.size < 7
722
688
 
723
- givenclass = argv2[0, 1]
724
- eestatuses = if givenclass == '2' || givenclass == '4' || givenclass == '5'
725
- [givenclass + '.']
726
- else
727
- ['5.', '4.', '2.']
728
- end
689
+ case argv2[0, 1]
690
+ when '2', '4', '5' then eestatuses = [argv2[0, 1] + '.']
691
+ else eestatuses = ['5.', '4.', '2.']
692
+ end
729
693
  esmtperror = ' ' + argv1 + ' ' # Why 3 space characters? see https://github.com/sisimai/p5-sisimai/issues/574
730
694
  lookingfor = []
731
695
 
@@ -831,7 +795,7 @@ module Sisimai
831
795
  return argv0 if argv1.nil?; return argv0 if argv1.size < 5
832
796
 
833
797
  statuscode = argv0
834
- codeinmesg = argv1
798
+ codeinmesg = argv1; return codeinmesg if statuscode.index(".9.") == 1
835
799
  esmtpreply = argv2 || '000'
836
800
  the1stchar = {
837
801
  'field' => statuscode[0, 1].to_i,
@@ -862,22 +826,22 @@ module Sisimai
862
826
  end
863
827
 
864
828
  return statuscode if zeroindex2['error'] > 0 # An SMTP status code is "X.0.0"
865
- return codeinmesg if statuscode == '4.4.7' # "4.4.7" is an ambiguous code
866
- return codeinmesg if statuscode == '4.7.0' # "4.7.0" indicates "too many errors"
867
829
  return codeinmesg if statuscode.start_with?('5.3.') # "5.3.Z" is an error of a system
868
- return codeinmesg if statuscode.end_with?('.5.1') # "X.5.1" indicates an invalid command
869
- return codeinmesg if statuscode.end_with?('.5.2') # "X.5.2" indicates a syntax error
870
- return codeinmesg if statuscode.end_with?('.5.4') # "X.5.4" indicates an invalid command arguments
871
- return codeinmesg if statuscode.end_with?('.5.5') # "X.5.5" indicates a wrong protocol version
872
-
873
- if statuscode == '5.1.1'
830
+ return codeinmesg if statuscode.end_with?('.5.1', '.5.2', '.5.4', '.5.5')
831
+
832
+ case statuscode
833
+ # - "4.4.7" is an ambigous code
834
+ # - "4.7.0" indicates "too many errors"
835
+ # - "X.5.1" indicates an invalid command
836
+ # - "X.5.2" indicates a syntax error
837
+ # - "X.5.4" indicates an invalid command argument
838
+ # - "X.5.5" indicates a wrong protocol version
839
+ when "4.4.7", "4.7.0" then return codeinmesg
840
+ when "5.1.3" then return codeinmesg if codeinmesg.start_with?('5.7.')
841
+ when "5.1.1"
874
842
  # "5.1.1" is a code of "userunknown"
875
843
  return statuscode if codeinmesg.start_with?('5.5.') || zeroindex1['error'] > 0
876
844
  return codeinmesg
877
-
878
- elsif statuscode == '5.1.3'
879
- # "5.1.3"
880
- return codeinmesg if codeinmesg.start_with?('5.7.')
881
845
  end
882
846
 
883
847
  return statuscode
@@ -888,7 +852,7 @@ module Sisimai
888
852
  # @return bool false: The delivery status code is not explicit
889
853
  def is_explicit(argv1 = '')
890
854
  return false if argv1.nil? || argv1.empty?
891
- return false if argv1.size == 7 && argv1.start_with?("5.0.9", "4.0.9")
855
+ return false if argv1.size == 7 && argv1.start_with?("5.9.", "4.9.")
892
856
  return true
893
857
  end
894
858
 
@@ -7,21 +7,6 @@ module Sisimai
7
7
  body: %r|<head>.+</head>.*<body[ >].+</body>|im,
8
8
  }
9
9
 
10
- # Create message token from addresser and recipient
11
- # @param [String] addr1 Sender address
12
- # @param [String] addr2 Recipient address
13
- # @param [Integer] epoch Machine time of the email bounce
14
- # @return [String] Message token(MD5 hex digest) or blank(failed to create token)
15
- # @see http://en.wikipedia.org/wiki/ASCII
16
- def token(addr1, addr2, epoch)
17
- return "" if addr1.is_a?(::String) == false || addr2.is_a?(::String) == false
18
- return "" if addr1.empty? || addr2.empty? || epoch.is_a?(Integer) == false
19
-
20
- # Format: STX(0x02) Sender-Address RS(0x1e) Recipient-Address ETX(0x03)
21
- require 'digest/sha1'
22
- return Digest::SHA1.hexdigest(sprintf("\x02%s\x1e%s\x1e%d\x03", addr1.downcase, addr2.downcase, epoch))
23
- end
24
-
25
10
  # The argument is 8-bit text or not
26
11
  # @param [String] argvs Any string to be checked
27
12
  # @return [Boolean] false: ASCII Characters only, true: Including 8-bit character
@@ -32,18 +17,6 @@ module Sisimai
32
17
  return false
33
18
  end
34
19
 
35
- # Clean the string out
36
- # @param [String] argv1 String to be cleaned
37
- # @return [String] Cleaned out string
38
- # @example Clean up text
39
- # sweep(' neko ') #=> 'neko'
40
- def sweep(argv1)
41
- return argv1 if argv1.is_a?(::String) == false
42
- argv1 = argv1.chomp.squeeze(' ').strip
43
- argv1 = argv1.sub(/ [-]{2,}[^ ].+\z/, '')
44
- return argv1
45
- end
46
-
47
20
  # Check if each element of the 2nd argument is aligned in the 1st argument or not
48
21
  # @param [String] argv1 String to be checked
49
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.5.0'.freeze
3
+ VERSION = '5.7.0'.freeze
4
4
  end
@@ -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
+
@@ -0,0 +1,50 @@
1
+ Return-Path: <kijitora-nyaan@example.org>
2
+ Delivered-To: sironeko@example.jp
3
+ Received: from example.com (unknown [192.0.2.250])
4
+ by r1.example.co.jp (Postfix) with ESMTP id FFFFFFFF00
5
+ for <sironeko@example.jp>; Thu, 29 Apr 2006 23:34:45 +0000 (UTC)
6
+ Received: from r2.example.org (r2.example.org [192.0.2.25])
7
+ by smtp.nyaan.example.net (8.10.1/8.10.1) with ESMTP id k3k000000000
8
+ for <sironeko@nyaan.example.net>; Thu,29 Apr 2006 23:34:45 +0000
9
+ Received: from [203.0.113.25] (helo=r9.example.net)
10
+ by r2.example.org with esmtp (Exim 3.21 #1)
11
+ id AAAAAA-000000-22
12
+ for kijitora-nyaan@example.org; Thu, 29 Apr 2006 23:34:45 +0000
13
+ Received: from smtp1.r.example.net ([209.196.123.3])
14
+ by mx7.example.net with smtp (Exim 3.16 #10)
15
+ id BBBBBB-111111-22
16
+ for kijitora-nyaan@example.org; Thu, 29 Apr 2006 23:34:45 +0000
17
+ Message-Id: <ffffffffffffffff1@smtp1.r.example.net>
18
+ From: <MAILER-DAEMON@example.net>
19
+ To: kijitora-nyaan@example.org
20
+ Date: Thu, 29 Apr 2006 23:34:45 +0000 (UTC)
21
+ Subject: mail failed, returning to sender
22
+
23
+ |------------------------- Message log follows: -------------------------|
24
+ no valid recipients were found for this message
25
+ |------------------------- Failed addresses follow: ---------------------|
26
+ kijitora@neko.nyaan.example.com ... unknown host
27
+ |------------------------- Message text follows: ------------------------|
28
+ Received: from r2.example.org ([192.0.2.25])
29
+ by mx1.example.net with esmtp (Exim 3.22 #2)
30
+ id aaaaaa-444444-22
31
+ for kijitora@neosoft.com; Thu, 29 Apr 2006 23:34:45 +0000
32
+ Received: from localhost.localdomain ([127.0.0.1] helo=r2.example.org)
33
+ by r2.example.org with esmtp (Exim 3.22 #2)
34
+ id 000000-000000-00; Thu, 29 Apr 2006 23:34:45 +0000
35
+ Received: from [203.0.113.1] (helo=[127.0.0.1])
36
+ by r2.example.org with smtp (Exim 3.22 #2)
37
+ id eeeeee-rrrrrr-22
38
+ for neko-nyaan@example.org; Thu, 29 Apr 2006 23:34:45 +0000
39
+ Message-Id: <ffffffffffff000000002222000000000@e3.example.com>
40
+ To: kijitora@neko.nyaan.example.com
41
+ From: Neko <sironeko@example.jp>
42
+ Cc: neko-nyaan@example.org
43
+ Mime-Version: 1.0
44
+ Content-Type: text/plain; charset="us-ascii"; format=flowed
45
+ Date: Thu, 29 Apr 2006 23:34:45 +0000
46
+ Subject: Nyaan
47
+
48
+ Nyaan
49
+
50
+