sisimai 5.7.0-java → 5.7.2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codecovio.yml +1 -1
  3. data/.github/workflows/rake-test.yml +1 -1
  4. data/ChangeLog.md +25 -0
  5. data/README-JA.md +14 -13
  6. data/README.md +12 -12
  7. data/lib/sisimai/arf.rb +2 -1
  8. data/lib/sisimai/eb.rb +116 -0
  9. data/lib/sisimai/fact.rb +24 -17
  10. data/lib/sisimai/lda.rb +20 -18
  11. data/lib/sisimai/lhost/amazonses.rb +11 -10
  12. data/lib/sisimai/lhost/courier.rb +4 -3
  13. data/lib/sisimai/lhost/domino.rb +2 -1
  14. data/lib/sisimai/lhost/einsundeins.rb +3 -2
  15. data/lib/sisimai/lhost/exchange2003.rb +8 -7
  16. data/lib/sisimai/lhost/exchange2007.rb +14 -13
  17. data/lib/sisimai/lhost/exim.rb +7 -6
  18. data/lib/sisimai/lhost/ezweb.rb +4 -3
  19. data/lib/sisimai/lhost/fml.rb +4 -3
  20. data/lib/sisimai/lhost/gmail.rb +10 -9
  21. data/lib/sisimai/lhost/googlegroups.rb +3 -2
  22. data/lib/sisimai/lhost/googleworkspace.rb +2 -1
  23. data/lib/sisimai/lhost/imailserver.rb +3 -2
  24. data/lib/sisimai/lhost/kddi.rb +4 -3
  25. data/lib/sisimai/lhost/notes.rb +2 -1
  26. data/lib/sisimai/lhost/postfix.rb +7 -6
  27. data/lib/sisimai/lhost/qmail.rb +10 -9
  28. data/lib/sisimai/lhost/sendmail.rb +4 -3
  29. data/lib/sisimai/lhost/trendmicro.rb +2 -1
  30. data/lib/sisimai/lhost/v5sendmail.rb +2 -1
  31. data/lib/sisimai/lhost/verizon.rb +3 -2
  32. data/lib/sisimai/message.rb +5 -6
  33. data/lib/sisimai/reason/authfailure.rb +6 -5
  34. data/lib/sisimai/reason/badreputation.rb +5 -4
  35. data/lib/sisimai/reason/blocked.rb +6 -5
  36. data/lib/sisimai/reason/contenterror.rb +6 -5
  37. data/lib/sisimai/reason/delivered.rb +3 -2
  38. data/lib/sisimai/reason/emailtoolarge.rb +6 -5
  39. data/lib/sisimai/reason/expired.rb +3 -2
  40. data/lib/sisimai/reason/failedstarttls.rb +5 -3
  41. data/lib/sisimai/reason/feedback.rb +2 -1
  42. data/lib/sisimai/reason/filtered.rb +9 -8
  43. data/lib/sisimai/reason/hasmoved.rb +5 -4
  44. data/lib/sisimai/reason/hostunknown.rb +5 -4
  45. data/lib/sisimai/reason/mailboxfull.rb +7 -6
  46. data/lib/sisimai/reason/mailererror.rb +3 -2
  47. data/lib/sisimai/reason/networkerror.rb +3 -2
  48. data/lib/sisimai/reason/norelaying.rb +4 -3
  49. data/lib/sisimai/reason/notaccept.rb +5 -4
  50. data/lib/sisimai/reason/notcompliantrfc.rb +4 -3
  51. data/lib/sisimai/reason/onhold.rb +8 -7
  52. data/lib/sisimai/reason/policyviolation.rb +7 -6
  53. data/lib/sisimai/reason/ratelimited.rb +5 -4
  54. data/lib/sisimai/reason/rejected.rb +18 -14
  55. data/lib/sisimai/reason/requireptr.rb +5 -4
  56. data/lib/sisimai/reason/securityerror.rb +4 -3
  57. data/lib/sisimai/reason/spamdetected.rb +6 -5
  58. data/lib/sisimai/reason/suppressed.rb +4 -3
  59. data/lib/sisimai/reason/suspend.rb +4 -3
  60. data/lib/sisimai/reason/syntaxerror.rb +4 -3
  61. data/lib/sisimai/reason/systemerror.rb +3 -2
  62. data/lib/sisimai/reason/systemfull.rb +4 -3
  63. data/lib/sisimai/reason/undefined.rb +2 -1
  64. data/lib/sisimai/reason/userunknown.rb +13 -9
  65. data/lib/sisimai/reason/vacation.rb +2 -1
  66. data/lib/sisimai/reason/virusdetected.rb +6 -5
  67. data/lib/sisimai/reason.rb +45 -40
  68. data/lib/sisimai/rfc1894.rb +8 -2
  69. data/lib/sisimai/rfc2045.rb +6 -3
  70. data/lib/sisimai/rfc3464/thirdparty.rb +10 -9
  71. data/lib/sisimai/rfc3834.rb +4 -2
  72. data/lib/sisimai/rhost/aol.rb +3 -2
  73. data/lib/sisimai/rhost/apple.rb +12 -11
  74. data/lib/sisimai/rhost/cloudflare.rb +3 -2
  75. data/lib/sisimai/rhost/cox.rb +38 -37
  76. data/lib/sisimai/rhost/facebook.rb +17 -16
  77. data/lib/sisimai/rhost/franceptt.rb +39 -38
  78. data/lib/sisimai/rhost/godaddy.rb +35 -34
  79. data/lib/sisimai/rhost/google.rb +22 -21
  80. data/lib/sisimai/rhost/gsuite.rb +8 -7
  81. data/lib/sisimai/rhost/iua.rb +11 -10
  82. data/lib/sisimai/rhost/kddi.rb +3 -2
  83. data/lib/sisimai/rhost/messagelabs.rb +13 -12
  84. data/lib/sisimai/rhost/microsoft.rb +33 -32
  85. data/lib/sisimai/rhost/mimecast.rb +18 -17
  86. data/lib/sisimai/rhost/nttdocomo.rb +10 -9
  87. data/lib/sisimai/rhost/outlook.rb +3 -2
  88. data/lib/sisimai/rhost/spectrum.rb +19 -18
  89. data/lib/sisimai/rhost/tencent.rb +10 -9
  90. data/lib/sisimai/rhost/yahooinc.rb +11 -10
  91. data/lib/sisimai/rhost/zoho.rb +8 -7
  92. data/lib/sisimai/smtp/command.rb +13 -8
  93. data/lib/sisimai/smtp/failure.rb +9 -8
  94. data/lib/sisimai/smtp/reply.rb +23 -22
  95. data/lib/sisimai/smtp/status.rb +141 -140
  96. data/lib/sisimai/smtp/transcript.rb +3 -2
  97. data/lib/sisimai/string.rb +4 -3
  98. data/lib/sisimai/version.rb +1 -1
  99. data/lib/sisimai.rb +2 -1
  100. data/set-of-emails/maildir/bsd/lhost-postfix-81.eml +130 -0
  101. data/set-of-emails/should-not-crash/go-423-deeply-nested-mime-parts.eml +20050 -0
  102. metadata +5 -2
@@ -46,6 +46,7 @@ module Sisimai
46
46
  # Sisimai::SMTP::Reply is utilities for getting SMTP Reply Code value from error message text.
47
47
  module Reply
48
48
  class << self
49
+ require 'sisimai/eb'
49
50
  ReplyCode2 = [
50
51
  # http://www.ietf.org/rfc/rfc5321.txt
51
52
  # 211 System status, or system help reply
@@ -111,28 +112,28 @@ module Sisimai
111
112
  ].freeze
112
113
  CodeOfSMTP = {'2' => ReplyCode2, '4' => ReplyCode4, '5' => ReplyCode5}.freeze
113
114
  Associated = {
114
- "422" => ["AUTH", "4.7.12", "securityerror"], # RFC5238
115
- "432" => ["AUTH", "4.7.12", "securityerror"], # RFC4954, RFC5321
116
- "451" => ["", "", "systemerror"], # RFC2465, RFC5321
117
- "452" => ["", "", "systemfull"], # RFC5321
118
- "454" => ["AUTH", "4.7.0", "securityerror"], # RFC3027, RFC4954
119
- "455" => ["", "", "syntaxerror"], # RFC5321
120
- "500" => ["", "", "syntaxerror"], # RFC5321
121
- "501" => ["", "", "syntaxerror"], # RFC5321
122
- "502" => ["", "", "syntaxerror"], # RFC5321
123
- "503" => ["", "", "syntaxerror"], # RFC5321
124
- "504" => ["", "", "syntaxerror"], # RFC5321
125
- "521" => ["CONN", "", "notaccept"], # RFC7504
126
- "523" => ["AUTH", "5.7.10", "securityerror"], # RFC5248
127
- "524" => ["AUTH", "5.7.11", "securityerror"], # RFC5248
128
- "525" => ["AUTH", "5.7.13", "securityerror"], # RFC5248
129
- "534" => ["AUTH", "5.7.9", "securityerror"], # RFC4954, RFC5248
130
- "535" => ["AUTH", "5.7.8", "securityerror"], # RFC4954, RFC5248
131
- "538" => ["AUTH", "5.7.11", "securityerror"], # RFC4954, RFC5248
132
- "551" => ["", "", "hasmoved"], # RFC5321, RFC5336, RFC6531
133
- "552" => ["", "", "mailboxfull"], # RFC5321
134
- "555" => ["", "", "syntaxerror"], # RFC5321
135
- "556" => ["RCPT", "", "notaccept"], # RFC7504
115
+ "422" => [Sisimai::Eb::CeAUTH, "4.7.12", Sisimai::Eb::ReSAFE], # RFC5238
116
+ "432" => [Sisimai::Eb::CeAUTH, "4.7.12", Sisimai::Eb::ReSAFE], # RFC4954, RFC5321
117
+ "451" => ["", "", Sisimai::Eb::RePROC], # RFC2465, RFC5321
118
+ "452" => ["", "", Sisimai::Eb::ReDISK], # RFC5321
119
+ "454" => [Sisimai::Eb::CeAUTH, "4.7.0", Sisimai::Eb::ReSAFE], # RFC3027, RFC4954
120
+ "455" => ["", "", Sisimai::Eb::ReCOMM], # RFC5321
121
+ "500" => ["", "", Sisimai::Eb::ReCOMM], # RFC5321
122
+ "501" => ["", "", Sisimai::Eb::ReCOMM], # RFC5321
123
+ "502" => ["", "", Sisimai::Eb::ReCOMM], # RFC5321
124
+ "503" => ["", "", Sisimai::Eb::ReCOMM], # RFC5321
125
+ "504" => ["", "", Sisimai::Eb::ReCOMM], # RFC5321
126
+ "521" => [Sisimai::Eb::CeCONN, "", Sisimai::Eb::Re00MX], # RFC7504
127
+ "523" => [Sisimai::Eb::CeAUTH, "5.7.10", Sisimai::Eb::ReSAFE], # RFC5248
128
+ "524" => [Sisimai::Eb::CeAUTH, "5.7.11", Sisimai::Eb::ReSAFE], # RFC5248
129
+ "525" => [Sisimai::Eb::CeAUTH, "5.7.13", Sisimai::Eb::ReSAFE], # RFC5248
130
+ "534" => [Sisimai::Eb::CeAUTH, "5.7.9", Sisimai::Eb::ReSAFE], # RFC4954, RFC5248
131
+ "535" => [Sisimai::Eb::CeAUTH, "5.7.8", Sisimai::Eb::ReSAFE], # RFC4954, RFC5248
132
+ "538" => [Sisimai::Eb::CeAUTH, "5.7.11", Sisimai::Eb::ReSAFE], # RFC4954, RFC5248
133
+ "551" => ["", "", Sisimai::Eb::ReMOVE], # RFC5321, RFC5336, RFC6531
134
+ "552" => ["", "", Sisimai::Eb::ReFULL], # RFC5321
135
+ "555" => ["", "", Sisimai::Eb::ReCOMM], # RFC5321
136
+ "556" => [Sisimai::Eb::CeRCPT, "", Sisimai::Eb::Re00MX], # RFC7504
136
137
  }.freeze
137
138
 
138
139
  # Check whether a reply code is a valid code or not
@@ -485,6 +485,7 @@ module Sisimai
485
485
  # reason from D.S.N. value, and getting D.S.N. from the text including D.S.N.
486
486
  module Status
487
487
  class << self
488
+ require "sisimai/eb"
488
489
  require "sisimai/rfc791"
489
490
 
490
491
  CodePatterns = [
@@ -494,150 +495,150 @@ module Sisimai
494
495
  %r/\b(2[.][0-7][.][0-7])\b/, # 2.1.5
495
496
  ]
496
497
  StandardCode = {
497
- '2.1.5' => 'delivered', # Successfully delivered
498
+ '2.1.5' => Sisimai::Eb::ReSENT, # Successfully delivered
498
499
  # ---------------------------------------------------------------------------------------
499
- '4.1.6' => 'hasmoved', # Destination mailbox has moved, No forwarding address
500
- '4.1.7' => 'rejected', # Bad sender's mailbox address syntax
501
- '4.1.8' => 'rejected', # Bad sender's system address
502
- '4.1.9' => 'systemerror', # Message relayed to non-compliant mailer
503
- '4.2.1' => 'suspend', # Mailbox disabled, not accepting messages
504
- '4.2.2' => 'mailboxfull', # Mailbox full
505
- '4.2.3' => 'emailtoolarge', # Message length exceeds administrative limit
506
- '4.2.4' => 'systemerror', # Mailing list expansion problem
507
- # '4.3.0' => 'systemerror', # Other or undefined mail system status
508
- '4.3.1' => 'systemfull', # Mail system full
509
- '4.3.2' => 'notaccept', # System not accepting network messages
510
- '4.3.3' => 'systemerror', # System not capable of selected features
511
- '4.3.5' => 'systemerror', # System incorrectly configured
512
- # '4.4.0' => 'networkerror', # Other or undefined network or routing status
513
- '4.4.1' => 'expired', # No answer from host
514
- '4.4.2' => 'networkerror', # Bad connection
515
- '4.4.3' => 'systemerror', # Directory server failure
516
- '4.4.4' => 'networkerror', # Unable to route
517
- '4.4.5' => 'systemfull', # Mail system congestion
518
- '4.4.6' => 'networkerror', # Routing loop detected
519
- '4.4.7' => 'expired', # Delivery time expired
520
- '4.4.8' => 'networkerror', # Retry on IPv4
521
- # '4.5.0' => 'networkerror', # Other or undefined protocol status
522
- '4.5.3' => 'ratelimited', # Too many recipients
523
- '4.5.5' => 'systemerror', # Wrong protocol version
524
- '4.6.0' => 'contenterror', # Other or undefined media error
525
- '4.6.2' => 'contenterror', # Conversion required and prohibited
526
- '4.6.5' => 'contenterror', # Conversion Failed
527
- # :'4.7.0' => 'securityerror', # Other or undefined security status
528
- '4.7.1' => 'blocked', # Delivery not authorized, message refused
529
- '4.7.2' => 'rejected', # Mailing list expansion prohibited
530
- '4.7.5' => 'securityerror', # Cryptographic failure
531
- '4.7.6' => 'securityerror', # Cryptographic algorithm not supported
532
- '4.7.7' => 'securityerror', # Message integrity failure
533
- '4.7.12' => 'securityerror', # A password transition is needed
534
- '4.7.15' => 'securityerror', # Priority Level is too low
535
- '4.7.16' => 'emailtoolarge', # Message is too big for the specified priority
536
- '4.7.24' => 'authfailure ', # SPF validation error
537
- '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
538
539
  # ---------------------------------------------------------------------------------------
539
- '5.1.0' => 'userunknown', # Other address status
540
- '5.1.1' => 'userunknown', # Bad destination mailbox address
541
- '5.1.2' => 'hostunknown', # Bad destination system address
542
- '5.1.3' => 'userunknown', # Bad destination mailbox address syntax
543
- '5.1.4' => 'filtered', # Destination mailbox address ambiguous
544
- '5.1.6' => 'hasmoved', # Destination mailbox has moved, No forwarding address
545
- '5.1.7' => 'rejected', # Bad sender's mailbox address syntax
546
- '5.1.8' => 'rejected', # Bad sender's system address
547
- '5.1.9' => 'systemerror', # Message relayed to non-compliant mailer
548
- '5.1.10' => 'notaccept', # Recipient address has null MX
549
- '5.2.0' => 'filtered', # Other or undefined mailbox status
550
- '5.2.1' => 'filtered', # Mailbox disabled, not accepting messages
551
- '5.2.2' => 'mailboxfull', # Mailbox full
552
- '5.2.3' => 'emailtoolarge', # Message length exceeds administrative limit
553
- '5.2.4' => 'systemerror', # Mailing list expansion problem
554
- '5.3.0' => 'systemerror', # Other or undefined mail system status
555
- '5.3.1' => 'systemfull', # Mail system full
556
- '5.3.2' => 'notaccept', # System not accepting network messages
557
- '5.3.3' => 'systemerror', # System not capable of selected features
558
- '5.3.4' => 'emailtoolarge', # Message too big for system
559
- '5.3.5' => 'systemerror', # System incorrectly configured
560
- '5.4.0' => 'networkerror', # Other or undefined network or routing status
561
- '5.4.3' => 'systemerror', # Directory server failure
562
- '5.4.4' => 'hostunknown', # Unable to route
563
- '5.5.2' => 'systemerror', # If the server cannot BASE64 decode any client response (AUTH)
564
- '5.5.3' => 'ratelimited', # Too many recipients
565
- '5.5.4' => 'systemerror', # Invalid command arguments
566
- '5.5.5' => 'systemerror', # Wrong protocol version
567
- '5.5.6' => 'syntaxerror', # Authentication Exchange line is too long
568
- '5.6.0' => 'contenterror', # Other or undefined media error
569
- '5.6.1' => 'contenterror', # Media not supported
570
- '5.6.2' => 'contenterror', # Conversion required and prohibited
571
- '5.6.3' => 'contenterror', # Conversion required but not supported
572
- '5.6.5' => 'contenterror', # Conversion Failed
573
- '5.6.6' => 'contenterror', # Message content not available
574
- '5.6.7' => 'rejected', # Non-ASCII addresses not permitted for that sender/recipient
575
- '5.6.8' => 'contenterror', # UTF-8 string reply is required, but not permitted by the SMTP client
576
- '5.6.9' => 'contenterror', # UTF-8 header message cannot be transferred to one or more recipients
577
- '5.7.0' => 'securityerror', # Other or undefined security status
578
- '5.7.1' => 'securityerror', # Delivery not authorized, message refused
579
- '5.7.2' => 'securityerror', # Mailing list expansion prohibited
580
- '5.7.3' => 'securityerror', # Security conversion required but not possible
581
- '5.7.4' => 'securityerror', # Security features not supported
582
- '5.7.5' => 'securityerror', # Cryptographic failure
583
- '5.7.6' => 'securityerror', # Cryptographic algorithm not supported
584
- '5.7.7' => 'securityerror', # Message integrity failure
585
- '5.7.8' => 'securityerror', # Authentication credentials invalid
586
- '5.7.9' => 'securityerror', # Authentication mechanism is too weak
587
- '5.7.10' => 'securityerror', # Encryption Needed
588
- '5.7.11' => 'securityerror', # Encryption required for requested authentication mechanism
589
- '5.7.13' => 'suspend', # User Account Disabled
590
- '5.7.14' => 'securityerror', # Trust relationship required
591
- '5.7.15' => 'securityerror', # Priority Level is too low
592
- '5.7.16' => 'emailtoolarge', # Message is too big for the specified priority
593
- '5.7.17' => 'hasmoved', # Mailbox owner has changed
594
- '5.7.18' => 'hasmoved', # Domain owner has changed
595
- '5.7.19' => 'systemerror', # RRVS test cannot be completed
596
- '5.7.20' => 'authfailure', # No passing DKIM signature found
597
- '5.7.21' => 'authfailure', # No acceptable DKIM signature found
598
- '5.7.22' => 'authfailure', # No valid author-matched DKIM signature found
599
- '5.7.23' => 'authfailure', # SPF validation failed
600
- '5.7.24' => 'authfailure', # SPF validation error
601
- '5.7.25' => 'requireptr', # Reverse DNS validation failed
602
- '5.7.26' => 'authfailure', # Multiple authentication checks failed
603
- '5.7.27' => 'notaccept', # MX resource record of a destination host is Null MX: RFC7505
604
- '5.7.28' => 'spamdetected', # The message appears to be part of a mail flood of similar abusive messages.
605
- '5.7.29' => 'authfailure', # This status code may be returned when a message fails ARC validation.
606
- '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
607
608
  }.freeze
608
609
 
609
610
  InternalCode = {
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'],
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'],
641
642
  }.freeze
642
643
 
643
644
  # Convert from the reason string to the internal status code
@@ -839,7 +840,7 @@ module Sisimai
839
840
  when "4.4.7", "4.7.0" then return codeinmesg
840
841
  when "5.1.3" then return codeinmesg if codeinmesg.start_with?('5.7.')
841
842
  when "5.1.1"
842
- # "5.1.1" is a code of "userunknown"
843
+ # "5.1.1" is a code of "UserUnknown"
843
844
  return statuscode if codeinmesg.start_with?('5.5.') || zeroindex1['error'] > 0
844
845
  return codeinmesg
845
846
  end
@@ -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
@@ -53,9 +53,10 @@ module Sisimai
53
53
  # 3. <a href = 'http://...'>...</a> to " http://... "
54
54
  # 4. <a href = 'mailto:...'>...</a> to " Value <mailto:...> "
55
55
  plain.scrub!('?')
56
- plain = plain.gsub(%r|<head>.+</head>|im, '')
57
- plain = plain.gsub(%r|<style.+?>.+</style>|im, '')
58
- plain = plain.gsub(%r|<a\s+href\s*=\s*['"](https?://.+?)['"].*?>(.*?)</a>|i, '[\2](\1)')
56
+ cv = plain.downcase
57
+ plain = plain.gsub(%r|<head>.+?</head>|im, "") if cv.include?("</head>")
58
+ plain = plain.gsub(%r|<style.+?>.+?</style>|im, "") if cv.include?("</style>")
59
+ plain = plain.gsub(%r|<a\s+href\s*=\s*(['"])(https?://[^'"]+?)\1[^>]*?>(.*?)</a>|i, ' [\3](\2) ')
59
60
  plain = plain.gsub(%r|<a\s+href\s*=\s*["']mailto:([^\s]+?)["']>(.*?)</a>|i, '[\2](mailto:\1)')
60
61
  plain = plain.gsub(/<[^<@>]+?>\s*/, ' ') # Delete HTML tags except <neko@example.jp>
61
62
  plain = plain.gsub(/&lt;/, '<').gsub(/&gt;/, '>') # Convert to angle brackets
@@ -1,4 +1,4 @@
1
1
  # Define the version number of Sisimai
2
2
  module Sisimai
3
- VERSION = '5.7.0'.freeze
3
+ VERSION = '5.7.2'.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,130 @@
1
+ Return-Path: <>
2
+ Delivered-To: sironeko@example.com
3
+ Received: by e4.example.com (Postfix) via r2.example.com id FFFFFFFF00;
4
+ Thu, 29 Apr 2005 23:34:45 +0000 (UTC)
5
+ MIME-Version: 1.0
6
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-01"
7
+ Message-Id: <20050429233445.FFFFFFFF99@e4.example.com>
8
+ From: MAILER-DAEMON@e4.example.com (Mail Delivery System)
9
+ To: sironeko@e4.example.com
10
+ Subject: Undelivered Mail Returned to Sender
11
+ Date: Thu, 29 Apr 2005 23:34:45 +0000 (UTC)
12
+
13
+ This is a MIME-encapsulated message.
14
+
15
+ --BOUNDARY-DEPTH-01
16
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-02"
17
+
18
+ --BOUNDARY-DEPTH-02
19
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-03"
20
+
21
+ --BOUNDARY-DEPTH-03
22
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-04"
23
+
24
+ --BOUNDARY-DEPTH-04
25
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-05"
26
+
27
+ --BOUNDARY-DEPTH-05
28
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-06"
29
+
30
+ --BOUNDARY-DEPTH-06
31
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-07"
32
+
33
+ --BOUNDARY-DEPTH-07
34
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-08"
35
+
36
+ --BOUNDARY-DEPTH-08
37
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-09"
38
+
39
+ --BOUNDARY-DEPTH-09
40
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-10"
41
+
42
+ --BOUNDARY-DEPTH-10
43
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-11"
44
+
45
+ --BOUNDARY-DEPTH-11
46
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-12"
47
+
48
+ --BOUNDARY-DEPTH-12
49
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-13"
50
+
51
+ --BOUNDARY-DEPTH-13
52
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-14"
53
+
54
+ --BOUNDARY-DEPTH-14
55
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-15"
56
+
57
+ --BOUNDARY-DEPTH-15
58
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-16"
59
+
60
+ --BOUNDARY-DEPTH-16
61
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-17"
62
+
63
+ --BOUNDARY-DEPTH-17
64
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-18"
65
+
66
+ --BOUNDARY-DEPTH-18
67
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-19"
68
+
69
+ --BOUNDARY-DEPTH-19
70
+ Content-Type: multipart/mixed; boundary="BOUNDARY-DEPTH-20"
71
+
72
+ --BOUNDARY-DEPTH-20
73
+ Content-Description: Notification
74
+ Content-Type: text/plain
75
+
76
+ This is the Postfix program at host e4.example.com.
77
+
78
+ I'm sorry to have to inform you that the message returned
79
+ below could not be delivered to one or more destinations.
80
+
81
+ For further assistance, please contact <postmaster@e4.example.com>
82
+
83
+ If you do so, please include this problem report. You can
84
+ delete your own text from the message returned below.
85
+
86
+ The Postfix program
87
+
88
+ <kijitora@example.com>: Name service error for domain example.com: Host not
89
+ found, try again
90
+
91
+
92
+ --FFFF000020.0000110000/e4.example.com
93
+ Content-Description: Undelivered Message
94
+ Content-Type: message/rfc822
95
+
96
+ Received: by e4.example.com (Postfix, from userid 1)
97
+ id FFFFFFFF55; Thu, 29 Apr 2005 23:34:45 +0000 (UTC)
98
+ MIME-Version: 1.0
99
+ Content-Type: text/plain; charset=us-ascii
100
+ Content-Transfer-Encoding: 7bit
101
+ Message-ID: <ffffffffffffffff000000002@neko.nyaan.example.jp>
102
+ From: Neko <sironeko@example.or.jp>
103
+ Date: Thu, 29 Apr 2005 23:34:45 +0000
104
+ To: Kijitora <kijitora@example.com>
105
+ Subject: Nyaan
106
+
107
+ Nyaan
108
+
109
+ --FFFF000020.0000110000/e4.example.com--
110
+
111
+ --BOUNDARY-DEPTH-20--
112
+ --BOUNDARY-DEPTH-19--
113
+ --BOUNDARY-DEPTH-18--
114
+ --BOUNDARY-DEPTH-17--
115
+ --BOUNDARY-DEPTH-16--
116
+ --BOUNDARY-DEPTH-15--
117
+ --BOUNDARY-DEPTH-14--
118
+ --BOUNDARY-DEPTH-13--
119
+ --BOUNDARY-DEPTH-12--
120
+ --BOUNDARY-DEPTH-11--
121
+ --BOUNDARY-DEPTH-10--
122
+ --BOUNDARY-DEPTH-09--
123
+ --BOUNDARY-DEPTH-08--
124
+ --BOUNDARY-DEPTH-07--
125
+ --BOUNDARY-DEPTH-06--
126
+ --BOUNDARY-DEPTH-05--
127
+ --BOUNDARY-DEPTH-04--
128
+ --BOUNDARY-DEPTH-03--
129
+ --BOUNDARY-DEPTH-02--
130
+ --BOUNDARY-DEPTH-01--