├── lib └── sisimai │ ├── version.rb │ ├── smtp.rb │ ├── time.rb │ ├── reason │ ├── undefined.rb │ ├── feedback.rb │ ├── delivered.rb │ └── vacation.rb │ ├── fact │ ├── yaml.rb │ └── json.rb │ ├── rhost │ ├── cloudflare.rb │ ├── kddi.rb │ └── outlook.rb │ └── rfc5965.rb ├── CONTRIBUTING ├── set-of-emails ├── maildir │ ├── bsd │ │ ├── lhost-ezweb-02.eml │ │ ├── lhost-ezweb-03.eml │ │ ├── lhost-ezweb-04.eml │ │ ├── lhost-ezweb-05.eml │ │ ├── lhost-imailserver-04.eml │ │ ├── rfc3834-05.eml │ │ ├── lhost-imailserver-01.eml │ │ ├── lhost-imailserver-03.eml │ │ ├── lhost-qmail-03.eml │ │ ├── lhost-qmail-07.eml │ │ ├── lhost-qmail-08.eml │ │ ├── rfc3834-01.eml │ │ ├── lhost-v5sendmail-01.eml │ │ ├── lhost-dragonfly-04.eml │ │ ├── lhost-dragonfly-30.eml │ │ ├── lhost-v5sendmail-02.eml │ │ ├── rfc3834-02.eml │ │ ├── lhost-qmail-11.eml │ │ ├── lhost-qmail-12.eml │ │ ├── lhost-imailserver-06.eml │ │ ├── lhost-dragonfly-29.eml │ │ ├── lhost-verizon-01.eml │ │ ├── lhost-qmail-13.eml │ │ ├── lhost-exim-07.eml │ │ ├── lhost-dragonfly-26.eml │ │ ├── lhost-x2-03.eml │ │ ├── lhost-exchange2003-04.eml │ │ ├── lhost-exchange2003-01.eml │ │ ├── lhost-dragonfly-17.eml │ │ ├── lhost-dragonfly-05.eml │ │ ├── lhost-dragonfly-09.eml │ │ ├── lhost-dragonfly-15.eml │ │ ├── lhost-dragonfly-06.eml │ │ ├── lhost-dragonfly-21.eml │ │ ├── lhost-dragonfly-03.eml │ │ ├── lhost-dragonfly-12.eml │ │ ├── lhost-dragonfly-13.eml │ │ ├── lhost-dragonfly-24.eml │ │ ├── lhost-dragonfly-07.eml │ │ ├── lhost-dragonfly-20.eml │ │ ├── lhost-x1-03.eml │ │ ├── lhost-dragonfly-14.eml │ │ ├── lhost-dragonfly-23.eml │ │ ├── lhost-dragonfly-11.eml │ │ ├── lhost-dragonfly-16.eml │ │ ├── lhost-v5sendmail-06.eml │ │ ├── lhost-dragonfly-19.eml │ │ ├── lhost-dragonfly-10.eml │ │ ├── lhost-dragonfly-18.eml │ │ ├── lhost-dragonfly-22.eml │ │ ├── lhost-dragonfly-08.eml │ │ ├── lhost-v5sendmail-03.eml │ │ ├── lhost-qmail-05.eml │ │ ├── lhost-mailmarshal-02.eml │ │ ├── lhost-dragonfly-25.eml │ │ ├── arf-11.eml │ │ ├── arf-26.eml │ │ ├── lhost-qmail-16.eml │ │ ├── lhost-qmail-18.eml │ │ ├── lhost-v5sendmail-04.eml │ │ ├── arf-12.eml │ │ ├── lhost-qmail-04.eml │ │ ├── lhost-opensmtpd-02.eml │ │ ├── lhost-domino-01.eml │ │ ├── lhost-exim-52.eml │ │ ├── lhost-x2-06.eml │ │ ├── lhost-opensmtpd-01.eml │ │ ├── lhost-imailserver-02.eml │ │ └── lhost-qmail-19.eml │ ├── tmp │ │ ├── rfc3464-38.eml │ │ ├── rfc3464-39.eml │ │ └── lhost-exim-07.eml │ ├── mac │ │ ├── lhost-imailserver-01.eml │ │ ├── rfc3834-01.eml │ │ ├── lhost-v5sendmail-01.eml │ │ ├── lhost-verizon-01.eml │ │ ├── lhost-exchange-01.eml │ │ ├── lhost-exchange2003-01.eml │ │ ├── lhost-mailmarshalsmtp-01.eml │ │ ├── lhost-domino-01.eml │ │ ├── lhost-opensmtpd-01.eml │ │ └── lhost-einsundeins-01.eml │ ├── dos │ │ ├── lhost-imailserver-01.eml │ │ ├── rfc3834-01.eml │ │ ├── lhost-v5sendmail-01.eml │ │ ├── lhost-verizon-01.eml │ │ ├── lhost-exchange-01.eml │ │ ├── lhost-exchange2003-01.eml │ │ ├── lhost-mailmarshalsmtp-01.eml │ │ └── lhost-domino-01.eml │ ├── err │ │ └── make-test-07.eml │ └── not │ │ └── is-not-bounce-01.eml └── to-be-parsed-for-test │ └── README.md ├── bin ├── setup └── console ├── test ├── public │ ├── smtp-test.rb │ ├── lhost-x4.rb │ ├── lhost-x5.rb │ ├── rhost-iua.rb │ ├── lhost-bigfoot.rb │ ├── lhost-biglobe.rb │ ├── rhost-spectrum.rb │ ├── lhost-apachejames.rb │ ├── lhost-mailmarshal.rb │ ├── rhost-cloudflare.rb │ ├── lhost-googleworkspace.rb │ ├── lhost-fml.rb │ ├── lhost-x6.rb │ ├── rhost-cox.rb │ ├── rhost-kddi.rb │ ├── lhost-barracuda.rb │ ├── lhost-mimecast.rb │ ├── lhost-verizon.rb │ ├── rhost-facebook.rb │ ├── rhost-godaddy.rb │ ├── rhost-mimecast.rb │ ├── lhost-einsundeins.rb │ ├── lhost-mailfoundry.rb │ ├── sisimai-reason-is-onhold-test.rb │ ├── sisimai-reason-is-undefind-test.rb │ ├── lhost-activehunter.rb │ ├── sisimai-cannot-parse-yet-test.rb │ ├── lhost-kddi.rb │ ├── rhost-nttdocomo.rb │ ├── lhost-amavis.rb │ ├── lhost-domino.rb │ ├── lhost-mxlogic.rb │ ├── lhost-notes.rb │ ├── rhost-tencent.rb │ ├── lhost-powermta.rb │ ├── lhost-sendgrid.rb │ ├── rhost-yahooinc.rb │ ├── lhost-surfcontrol.rb │ ├── lhost-trendmicro.rb │ ├── rhost-messagelabs.rb │ ├── lhost-x1.rb │ ├── rhost-zoho.rb │ ├── lhost-courier.rb │ ├── lhost-yandex.rb │ ├── rfc5965-test.rb │ ├── lhost-gmx.rb │ ├── lhost-x3.rb │ ├── lhost-mcafee.rb │ ├── rhost-apple.rb │ ├── lhost-mfilter.rb │ ├── lhost-imailserver.rb │ ├── rfc3834.rb │ ├── lhost-zoho.rb │ ├── rhost-microsoft.rb │ ├── rhost-aol.rb │ ├── lhost-ezweb.rb │ ├── lhost-exchange2003.rb │ ├── lhost-amazonworkmail.rb │ ├── lhost-exchange2007.rb │ ├── rhost-google.rb │ ├── lhost-receivingses.rb │ ├── lhost-x2.rb │ ├── lhost-outlook.rb │ ├── rhost-outlook.rb │ ├── lhost-mailru.rb │ ├── rhost-franceptt.rb │ ├── time-test.rb │ ├── smtp-trascript-test.rb │ ├── lhost-v5sendmail.rb │ ├── lhost-office365.rb │ ├── lhost-messagingserver.rb │ ├── lhost-yahoo.rb │ ├── rhost-gsuite.rb │ ├── lhost-googlegroups.rb │ ├── lhost-gmail.rb │ ├── rfc791-test.rb │ ├── rhost-test.rb │ ├── lhost-opensmtpd.rb │ └── sample-emails-test.rb ├── private │ ├── lhost-receivingses.rb │ ├── lhost-googleworkspace.rb │ ├── lhost-x5.rb │ ├── lhost-fml.rb │ ├── lhost-bigfoot.rb │ ├── lhost-powermta.rb │ ├── lhost-verizon.rb │ ├── lhost-barracuda.rb │ ├── lhost-dragonfly.rb │ ├── lhost-kddi.rb │ ├── lhost-amavis.rb │ ├── lhost-yandex.rb │ ├── lhost-facebook.rb │ ├── lhost-mailmarshal.rb │ ├── lhost-messagelabs.rb │ ├── lhost-gmx.rb │ ├── lhost-zoho.rb │ ├── lhost-mailfoundry.rb │ ├── lhost-apachejames.rb │ ├── lhost-surfcontrol.rb │ ├── lhost-biglobe.rb │ ├── lhost-amazonworkmail.rb │ ├── lhost-x3.rb │ ├── lhost-mimecast.rb │ ├── lhost-mcafee.rb │ ├── lhost-x1.rb │ ├── lhost-sendgrid.rb │ ├── lhost-notes.rb │ ├── lhost-yahoo.rb │ ├── lhost-mxlogic.rb │ ├── lhost-courier.rb │ ├── lhost-mailru.rb │ ├── lhost-activehunter.rb │ ├── lhost-einsundeins.rb │ ├── rfc3834.rb │ ├── lhost-mfilter.rb │ ├── lhost-outlook.rb │ ├── lhost-googlegroups.rb │ └── lhost-aol.rb └── coverage.rb ├── .gitignore ├── Gemfile ├── Rakefile ├── appveyor.yml ├── sisimai.gemspec ├── .github └── workflows │ └── codecovio.yml └── sisimai-java.gemspec /lib/sisimai/version.rb: -------------------------------------------------------------------------------- 1 | # Define the version number of Sisimai 2 | module Sisimai 3 | VERSION = '5.5.0'.freeze 4 | end 5 | -------------------------------------------------------------------------------- /CONTRIBUTING: -------------------------------------------------------------------------------- 1 | CONTRIBUTING 2 | =================================================================================================== 3 | 4 | 5 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-ezweb-02.eml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sisimai/rb-sisimai/HEAD/set-of-emails/maildir/bsd/lhost-ezweb-02.eml -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-ezweb-03.eml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sisimai/rb-sisimai/HEAD/set-of-emails/maildir/bsd/lhost-ezweb-03.eml -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-ezweb-04.eml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sisimai/rb-sisimai/HEAD/set-of-emails/maildir/bsd/lhost-ezweb-04.eml -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-ezweb-05.eml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sisimai/rb-sisimai/HEAD/set-of-emails/maildir/bsd/lhost-ezweb-05.eml -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | bundle install 6 | 7 | # Do any other automated setup that you need to do here 8 | -------------------------------------------------------------------------------- /lib/sisimai/smtp.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | # Sisimai::SMTP is a parent class of Sisimai::SMTP::Status and Sisimai::SMTP::Reply. 3 | module SMTP 4 | class << self 5 | end 6 | end 7 | end 8 | 9 | -------------------------------------------------------------------------------- /test/public/smtp-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'sisimai/smtp' 3 | 4 | class SMTPTest < Minitest::Test 5 | def test_module 6 | assert_equal Module, Sisimai::SMTP.class 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /sbin 9 | /spec/reports/ 10 | /set-of-emails/private/ 11 | /set-of-emails/obsoleted/ 12 | /tmp/ 13 | .rubocop_todo.yml 14 | -------------------------------------------------------------------------------- /lib/sisimai/time.rb: -------------------------------------------------------------------------------- 1 | require 'date' 2 | module Sisimai 3 | # Sisimai::Time is a child class of Date for Sisimai::Fact 4 | class Time < ::DateTime 5 | def to_json(*) 6 | return self.to_time.to_i 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/public/lhost-x4.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module X4 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.922', '', 'mailboxfull', false, false]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/lhost-x5.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module X5 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/rhost-iua.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module IUA 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.0', '550', 'suspend', false, true]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/lhost-bigfoot.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Bigfoot 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '02' => [['5.7.1', '553', 'userunknown', true, true]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/lhost-biglobe.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Biglobe 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.922', '', 'mailboxfull', false, false]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/rhost-spectrum.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Spectrum 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.0', '550', 'toomanyconn', false, false]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/lhost-apachejames.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module ApacheJames 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.910', '550', 'filtered', false, true]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/lhost-mailmarshal.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module MailMarshal 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/rhost-cloudflare.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Cloudflare 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['4.3.0', '421', 'systemerror', false, false]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/private/lhost-receivingses.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module ReceivingSES 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.2.3', '552', 'exceedlimit', false, false]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/lhost-googleworkspace.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module GoogleWorkspace 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.918', '', 'rejected', false, false]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/private/lhost-googleworkspace.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module GoogleWorkspace 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.918', '', 'rejected', false, false]], 6 | } 7 | end 8 | end 9 | 10 | -------------------------------------------------------------------------------- /test/public/lhost-fml.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module FML 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '02' => [['5.0.918', '', 'rejected', false, false]], 6 | '03' => [['5.0.974', '', 'notcompliantrfc', false, false]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/lhost-x6.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module X6 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.4.6', '554', 'networkerror', false, false]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/rhost-cox.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Cox 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.0', '550', 'blocked', false, false], 6 | ['5.1.0', '550', 'blocked', false, false]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/rhost-kddi.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module KDDI 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.2.0', '550', 'filtered', false, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/private/lhost-x5.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module X5 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '1002' => [['5.1.1', '550', 'userunknown', true, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/private/lhost-fml.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module FML 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.974', '', 'notcompliantrfc', false, false]], 6 | '1002' => [['5.0.918', '', 'rejected', false, false]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/lhost-barracuda.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Barracuda 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.7.1', '550', 'spamdetected', false, false]], 6 | '02' => [['5.7.1', '550', 'spamdetected', false, false]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/lhost-mimecast.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Mimecast 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.4.1', '', 'userunknown', true, true]], 6 | '02' => [['5.7.54', '550', 'norelaying', false, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/lhost-verizon.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Verizon 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.911', '', 'userunknown', true, true]], 6 | '02' => [['5.0.911', '550', 'userunknown', true, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/rhost-facebook.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Facebook 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '03' => [['5.1.1', '550', 'filtered', false, true]], 6 | '04' => [['5.1.1', '550', 'userunknown', true, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/rhost-godaddy.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module GoDaddy 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '02' => [['5.1.3', '553', 'blocked', false, false]], 6 | '03' => [['5.1.1', '550', 'speeding', false, false]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/rhost-mimecast.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Mimecast 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.0', '554', 'policyviolation', false, false]], 6 | '02' => [['5.0.0', '554', 'spamdetected', false, false]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/private/lhost-bigfoot.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Bigfoot 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01001' => [['5.0.0', '554', 'spamdetected', false, false]], 6 | '01002' => [['5.7.1', '553', 'userunknown', true, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/private/lhost-powermta.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module PowerMTA 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.0', '554', 'userunknown', true, true]], 6 | '1002' => [['5.2.1', '550', 'suspend', false, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/private/lhost-verizon.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Verizon 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.911', '', 'userunknown', true, true]], 6 | '1002' => [['5.0.911', '550', 'userunknown', true, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/lhost-einsundeins.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module EinsUndEins 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '02' => [['5.0.934', '', 'mesgtoobig', false, false]], 6 | '03' => [['5.2.0', '550', 'spamdetected', false, false]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/lhost-mailfoundry.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module MailFoundry 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.910', '550', 'filtered', false, true]], 6 | '02' => [['5.1.1', '552', 'mailboxfull', false, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/sisimai-reason-is-onhold-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'sisimai' 3 | 4 | class ReasonIsOnHoldTest < Minitest::Test 5 | Samples = './set-of-emails/to-be-debugged-because/reason-is-onhold' 6 | 7 | if Dir.exist?(Samples) 8 | cv = Sisimai.rise(Samples) 9 | assert_instance_of Array, cv 10 | refute_empty cv 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/public/sisimai-reason-is-undefind-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'sisimai' 3 | 4 | class ReasonIsUndefinedTest < Minitest::Test 5 | Samples = './set-of-emails/to-be-debugged-because/reason-is-undefined' 6 | 7 | if Dir.exist?(Samples) 8 | cv = Sisimai.rise(Samples) 9 | assert_instance_of Array, cv 10 | refute_empty cv 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /test/private/lhost-barracuda.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Barracuda 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.7.1', '550', 'spamdetected', false, false]], 6 | '1002' => [['5.7.1', '550', 'spamdetected', false, false]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/private/lhost-dragonfly.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module DragonFly 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.7.26', '550', 'authfailure', false, false]], 6 | '1002' => [['5.0.947', '', 'expired', false, false]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /test/public/lhost-activehunter.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Activehunter 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.0.910', '550', 'filtered', false, true]], 7 | } 8 | end 9 | end 10 | 11 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in sisimai.gemspec 4 | gemspec name: 'sisimai' 5 | 6 | group :development, :test do 7 | gem 'rake', :require => false 8 | gem 'minitest', :require => false 9 | gem 'coveralls', :require => false 10 | gem 'simplecov', :require => false 11 | gem 'simplecov-cobertura', :require => false 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/public/sisimai-cannot-parse-yet-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'sisimai' 3 | 4 | class EmailCouldNotBeParsedTest < Minitest::Test 5 | Samples = './set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet' 6 | 7 | if Dir.exist?(Samples) 8 | cv = Sisimai.rise(Samples) 9 | assert_instance_of Array, cv 10 | assert_empty cv 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require "bundler/setup" 4 | require "sisimai" 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require "pry" 11 | # Pry.start 12 | 13 | require "irb" 14 | IRB.start 15 | -------------------------------------------------------------------------------- /test/public/lhost-kddi.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module KDDI 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.922', '', 'mailboxfull', false, false]], 6 | '02' => [['5.0.922', '', 'mailboxfull', false, false]], 7 | '03' => [['5.0.922', '', 'mailboxfull', false, false]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/rhost-nttdocomo.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module NTTDOCOMO 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce'], [...]] 5 | '01' => [['5.2.0', '550', 'filtered', false, true]], 6 | '02' => [['5.0.0', '550', 'userunknown', true, true]], 7 | '03' => [['5.0.0', '550', 'userunknown', true, true]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/lhost-amavis.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Amavis 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '03' => [['5.7.0', '554', 'notcompliantrfc', false, false]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/lhost-domino.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Domino 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.911', '', 'userunknown', true, true]], 6 | '02' => [['5.0.0', '', 'userunknown', true, true]], 7 | '03' => [['5.0.0', '', 'networkerror', false, false]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/lhost-mxlogic.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module MXLogic 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '03' => [['5.0.910', '550', 'filtered', false, true]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/lhost-notes.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Notes 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.901', '', 'onhold', false, false]], 6 | '02' => [['5.0.911', '', 'userunknown', true, true]], 7 | '03' => [['5.0.911', '', 'userunknown', true, true]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/rhost-tencent.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Tencent 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.0', '550', 'toomanyconn', false, false]], 6 | '02' => [['5.0.0', '550', 'toomanyconn', false, false]], 7 | '03' => [['5.0.0', '550', 'authfailure', false, false]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/private/lhost-kddi.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module KDDI 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.922', '', 'mailboxfull', false, false]], 6 | '1002' => [['5.0.922', '', 'mailboxfull', false, false]], 7 | '1003' => [['5.0.922', '', 'mailboxfull', false, false]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/lhost-powermta.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module PowerMTA 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.2.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.0.0', '554', 'userunknown', true, true]], 7 | '03' => [['5.2.1', '550', 'userunknown', true, true]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/lhost-sendgrid.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module SendGrid 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '03' => [['5.0.947', '', 'expired', false, false]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/rhost-yahooinc.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module YahooInc 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.7.9', '554', 'policyviolation', false, false]], 6 | '02' => [['4.7.0', '421', 'rejected', false, false]], 7 | '03' => [['5.0.0', '554', 'userunknown', true, true]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/private/lhost-amavis.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Amavis 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '1002' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '1003' => [['5.7.0', '554', 'notcompliantrfc', false, false]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/private/lhost-yandex.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Yandex 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '1002' => [['5.2.1', '550', 'userunknown', true, true], 7 | ['5.2.2', '550', 'mailboxfull', false, true]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/lhost-surfcontrol.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module SurfControl 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.0', '550', 'filtered', false, true]], 6 | '02' => [['5.0.0', '554', 'systemerror', false, false]], 7 | '03' => [['5.0.0', '554', 'systemerror', false, false]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/lhost-trendmicro.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module TrendMicro 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.0.911', '', 'userunknown', true, true]], 7 | '03' => [['5.0.911', '', 'userunknown', true, true]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/public/rhost-messagelabs.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module MessageLabs 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.0', '550', 'securityerror', false, false]], 6 | '02' => [['5.0.0', '550', 'userunknown', true, true]], 7 | '03' => [['5.0.0', '', 'onhold', false, false]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/private/lhost-facebook.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Facebook 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.1.1', '550', 'filtered', true, true]], 6 | '1002' => [['5.1.1', '550', 'filtered', true, true]], 7 | '1003' => [['5.1.1', '550', 'userunknown', true, true]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/private/lhost-mailmarshal.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module MailMarshal 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.3.0', '553', 'filtered', false, true], 6 | ['5.3.0', '553', 'filtered', false, true]], 7 | '1002' => [['5.1.1', '550', 'userunknown', true, true]], 8 | } 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/gem_helper' 2 | 3 | if RUBY_PLATFORM =~ /java/ 4 | filename = 'sisimai-java' 5 | else 6 | filename = 'sisimai' 7 | end 8 | Bundler::GemHelper.install_tasks :name => filename 9 | 10 | task :default => :test 11 | task :test => [:publictest, :privatetest] 12 | task :publictest do 13 | Dir.glob('./test/public/*-test.rb').each { |cf| require cf } 14 | end 15 | task :privatetest do 16 | Dir.glob('./test/private/*-test.rb').each { |cf| require cf } 17 | end 18 | 19 | -------------------------------------------------------------------------------- /test/public/lhost-x1.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module X1 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.910', '', 'filtered', false, false]], 6 | '02' => [['5.0.910', '', 'filtered', false, false]], 7 | '03' => [['5.0.910', '', 'filtered', false, false]], 8 | '04' => [['5.0.947', '', 'expired', false, false]], 9 | } 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /test/public/rhost-zoho.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Zoho 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.7.7', '554', 'policyviolation', false, false]], 7 | '03' => [['5.7.1', '554', 'rejected', false, false]], 8 | '04' => [['5.4.1', '', 'rejected', false, false]], 9 | } 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /test/coverage.rb: -------------------------------------------------------------------------------- 1 | require 'simplecov' 2 | require 'simplecov-cobertura' 3 | 4 | SimpleCov.start { add_filter ['test/public/', 'test/private/'] } 5 | SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter 6 | 7 | LhostEngine = './test/public/lhost-engine-test.rb' 8 | RhostEngine = './test/public/rhost-engine-test.rb' 9 | load LhostEngine 10 | load RhostEngine 11 | 12 | Dir.glob('./test/public/*.rb').each do |e| 13 | next if e == LhostEngine 14 | next if e == RhostEngine 15 | require e 16 | end 17 | 18 | -------------------------------------------------------------------------------- /test/public/lhost-courier.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Courier 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.0.0', '550', 'filtered', false, true]], 7 | '03' => [['5.7.1', '550', 'rejected', false, false]], 8 | '04' => [['5.0.0', '', 'hostunknown', true, true]], 9 | } 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /test/public/lhost-yandex.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Yandex 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.2.1', '550', 'userunknown', true, true], 7 | ['5.2.2', '550', 'mailboxfull', false, true]], 8 | '03' => [['4.4.1', '', 'expired', false, false]], 9 | } 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /lib/sisimai/reason/undefined.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | module Reason 3 | # Sisimai::Reason::Undefined is for only returning text and description. This class is called only 4 | # from Sisimai.reason method. 5 | module Undefined 6 | class << self 7 | def text; return 'undefined'; end 8 | def description; return 'Sisimai could not detect an error reason'; end 9 | def match; return false; end 10 | def true(*); return false; end 11 | end 12 | end 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-imailserver-04.eml: -------------------------------------------------------------------------------- 1 | Date: Thu, 29 Apr 2008 23:45:10 -0000 2 | Message-Id: <00000000000.0000000@example.net> 3 | Mime-Version: 1.0 4 | Content-Type: text/plain; charset=us-ascii 5 | From: "Postmaster" 6 | Sender: 7 | To: 8 | Subject: Undeliverable Mail 9 | X-Mailer: 10 | 11 | Delivery failed 20 attempts: kijitora@example.com 12 | 13 | 14 | Original message follows. 15 | ====================================END 16 | -------------------------------------------------------------------------------- /test/private/lhost-messagelabs.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module MessageLabs 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '1002' => [['5.0.0', '550', 'securityerror', false, false]], 7 | '1003' => [['5.0.0', '', 'userunknown', true, true]], 8 | '1004' => [['5.0.0', '550', 'userunknown', true, true]], 9 | } 10 | end 11 | end 12 | 13 | -------------------------------------------------------------------------------- /test/public/rfc5965-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'sisimai/rfc5965' 3 | 4 | class RFC5965Test < Minitest::Test 5 | Methods = { class: %w[FIELDINDEX] } 6 | 7 | def test_methods 8 | Methods[:class].each { |e| assert_respond_to Sisimai::RFC5965, e } 9 | end 10 | 11 | def test_FIELDINDEX 12 | cv = Sisimai::RFC5965.FIELDINDEX 13 | assert_instance_of Array, cv 14 | refute_empty cv 15 | 16 | ce = assert_raises ArgumentError do 17 | Sisimai::RFC5965.FIELDINDEX(nil) 18 | end 19 | end 20 | 21 | end 22 | 23 | -------------------------------------------------------------------------------- /test/public/lhost-gmx.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module GMX 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.2.2', '', 'mailboxfull', false, true]], 6 | '02' => [['5.1.1', '', 'userunknown', true, true]], 7 | '03' => [['5.2.1', '', 'userunknown', true, true], 8 | ['5.2.2', '', 'mailboxfull', false, true]], 9 | '04' => [['5.0.947', '', 'expired', false, false]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/public/lhost-x3.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module X3 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.3.0', '553', 'userunknown', true, true]], 6 | '02' => [['5.0.947', '', 'expired', false, false]], 7 | '03' => [['5.3.0', '553', 'userunknown', true, true]], 8 | '05' => [['5.0.900', '', 'undefined', false, false]], 9 | '06' => [['5.2.2', '552', 'mailboxfull', false, true]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /lib/sisimai/reason/feedback.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | module Reason 3 | # Sisimai::Reason::Feedback is for only returning text and description. This class is called only 4 | # from Sisimai.reason method and Sisimai::ARF class. 5 | module Feedback 6 | class << self 7 | def text; return 'feedback'; end 8 | def description; return 'Email forwarded to the sender as a complaint message from your mailbox provider'; end 9 | def match; return false; end 10 | def true(*); return false; end 11 | end 12 | end 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /test/public/lhost-mcafee.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module McAfee 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.910', '550', 'filtered', false, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '03' => [['5.1.1', '550', 'userunknown', true, true]], 8 | '04' => [['5.0.910', '550', 'filtered', false, true]], 9 | '05' => [['5.0.910', '550', 'filtered', false, true]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/public/rhost-apple.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Apple 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.6', '550', 'hasmoved', true, true]], 6 | '02' => [['5.7.1', '554', 'authfailure', false, false]], 7 | '03' => [['5.2.2', '552', 'mailboxfull', false, true]], 8 | '04' => [['5.1.1', '550', 'suspend', false, true]], 9 | '05' => [['5.1.1', '550', 'userunknown', true, true]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/public/lhost-mfilter.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module MFILTER 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.910', '550', 'filtered', false, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '03' => [['5.0.910', '550', 'filtered', false, true]], 8 | '04' => [['5.4.1', '550', 'rejected', false, false]], 9 | '05' => [['4.3.1', '452', 'systemfull', false, false]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: '{build}' 2 | 3 | install: 4 | - SET PATH=C:\Ruby%ruby_version%\bin;%PATH% 5 | - "%devkit%\\devkitvars.bat" 6 | - ruby --version 7 | - gem --version 8 | - bundle install 9 | build: off 10 | test_script: 11 | - bundle exec rake spec TESTOPTS=-v 12 | 13 | environment: 14 | matrix: 15 | - ruby_version: "22-x64" 16 | devkit: C:\Ruby21-x64\DevKit 17 | - ruby_version: "22" 18 | devkit: C:\Ruby21\DevKit 19 | - ruby_version: "21-x64" 20 | devkit: C:\Ruby21-x64\DevKit 21 | - ruby_version: "21" 22 | devkit: C:\Ruby21\DevKit 23 | 24 | -------------------------------------------------------------------------------- /test/private/lhost-gmx.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module GMX 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.947', '', 'expired', false, false]], 6 | '1002' => [['5.1.1', '', 'userunknown', true, true]], 7 | '1003' => [['5.2.2', '', 'mailboxfull', false, true]], 8 | '1004' => [['5.2.1', '', 'userunknown', true, true], 9 | ['5.2.2', '', 'mailboxfull', false, true]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/private/lhost-zoho.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Zoho 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '1002' => [['5.2.1', '550', 'filtered', false, true], 7 | ['5.2.2', '550', 'mailboxfull', false, true]], 8 | '1003' => [['5.0.910', '550', 'filtered', false, true]], 9 | '1004' => [['4.0.947', '421', 'expired', false, false]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/public/lhost-imailserver.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module IMailServer 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.911', '', 'userunknown', true, true]], 6 | '02' => [['5.0.922', '', 'mailboxfull', false, false]], 7 | '03' => [['5.0.911', '', 'userunknown', true, true]], 8 | '04' => [['5.0.947', '', 'expired', false, false]], 9 | '06' => [['5.0.980', '550', 'spamdetected', false, false]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/public/rfc3834.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module RFC3834 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['', '', 'vacation', false, false]], 6 | '02' => [['', '', 'vacation', false, false]], 7 | '03' => [['', '', 'vacation', false, false]], 8 | '04' => [['', '', 'vacation', false, false]], 9 | '05' => [['', '', 'vacation', false, false]], 10 | '06' => [['5.0.921', '', 'suspend', false, true]], 11 | } 12 | end 13 | end 14 | 15 | -------------------------------------------------------------------------------- /test/private/lhost-mailfoundry.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module MailFoundry 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce'], [...]] 5 | '1001' => [['5.0.910', '550', 'filtered', false, true]], 6 | '1002' => [['5.1.1', '552', 'mailboxfull', false, true]], 7 | '1003' => [['5.1.1', '550', 'userunknown', true, true]], 8 | '1004' => [['5.0.910', '550', 'filtered', false, true]], 9 | '1005' => [['5.1.1', '552', 'mailboxfull', false, true]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/private/lhost-apachejames.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module ApacheJames 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.910', '550', 'filtered', false, true]], 6 | '1002' => [['5.0.910', '550', 'filtered', false, true]], 7 | '1003' => [['5.0.910', '550', 'filtered', false, true]], 8 | '1004' => [['5.0.901', '', 'onhold', false, false]], 9 | '1005' => [['5.0.901', '', 'onhold', false, false]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /test/private/lhost-surfcontrol.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module SurfControl 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.0', '550', 'filtered', false, true]], 6 | '1002' => [['5.0.0', '550', 'filtered', false, true]], 7 | '1003' => [['5.0.0', '550', 'filtered', false, true]], 8 | '1004' => [['5.0.0', '554', 'systemerror', false, false]], 9 | '1005' => [['5.0.0', '554', 'systemerror', false, false]], 10 | } 11 | end 12 | end 13 | 14 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/rfc3834-05.eml: -------------------------------------------------------------------------------- 1 | From MAILER-DAEMON Mon Sep 20 19:29:27 2021 2 | Return-Path: <> 3 | X-Original-To: postmaster@peter.otto.org 4 | Delivered-To: blackhole@localhost 5 | From: 6 | To: postmaster@any.com 7 | Message-ID: 8 | Date: Mon, 20 Sep 2021 21:29:21 +0200 (CEST) 9 | X-RZG-CLASS-ID: mi 10 | X-RZG-TRIGGERING-SMTP-ID: qcZaAFivUJ 11 | MIME-Version: 1.0 12 | Content-Type: text/plain; charset="UTF-8" 13 | Content-Transfer-Encoding: quoted-printable 14 | Subject: kitununulinitoquekegu 15 | In-Reply-To: 16 | Auto-Submitted: auto-replied 17 | 18 | zuk=C3=BCnftig 19 | karl@hanz.de 20 | -------------------------------------------------------------------------------- /test/public/lhost-zoho.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Zoho 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.2.1', '550', 'filtered', false, true], 7 | ['5.2.2', '550', 'mailboxfull', false, true]], 8 | '03' => [['5.0.910', '550', 'filtered', false, true]], 9 | '04' => [['4.0.947', '421', 'expired', false, false]], 10 | '05' => [['4.0.947', '421', 'expired', false, false]], 11 | } 12 | end 13 | end 14 | 15 | -------------------------------------------------------------------------------- /test/public/rhost-microsoft.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Microsoft 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.7.606', '550', 'blocked', false, false]], 6 | '02' => [['5.4.1', '550', 'userunknown', true, true]], 7 | '03' => [['5.1.10', '550', 'userunknown', true, true]], 8 | '04' => [['5.7.509', '550', 'authfailure', false, false]], 9 | '05' => [['4.7.650', '451', 'badreputation', false, false]], 10 | '06' => [['5.7.515', '550', 'authfailure', false, false]], 11 | } 12 | end 13 | end 14 | 15 | -------------------------------------------------------------------------------- /test/private/lhost-biglobe.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Biglobe 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.922', '', 'mailboxfull', false, false]], 6 | '1002' => [['5.0.922', '', 'mailboxfull', false, false]], 7 | '1003' => [['5.0.922', '', 'mailboxfull', false, false]], 8 | '1004' => [['5.0.922', '', 'mailboxfull', false, false]], 9 | '1005' => [['5.0.910', '', 'filtered', false, false]], 10 | '1006' => [['5.0.910', '', 'filtered', false, false]], 11 | } 12 | end 13 | end 14 | 15 | -------------------------------------------------------------------------------- /test/private/lhost-amazonworkmail.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module AmazonWorkMail 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01001' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '01002' => [['5.2.1', '550', 'filtered', false, true]], 7 | '01003' => [['5.3.5', '550', 'systemerror', false, false]], 8 | '01004' => [['5.2.2', '550', 'mailboxfull', false, true]], 9 | '01005' => [['4.4.2', '421', 'expired', false, false]], 10 | '01006' => [['5.2.2', '550', 'mailboxfull', false, true]], 11 | } 12 | end 13 | end 14 | 15 | -------------------------------------------------------------------------------- /test/public/rhost-aol.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Aol 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.4.4', '', 'hostunknown', true, true]], 6 | '02' => [['5.2.2', '550', 'mailboxfull', false, true]], 7 | '03' => [['5.2.2', '550', 'mailboxfull', false, true], 8 | ['5.1.1', '550', 'userunknown', true, true]], 9 | '04' => [['5.1.1', '550', 'userunknown', true, true]], 10 | '05' => [['5.4.4', '', 'hostunknown', true, true]], 11 | '06' => [['5.4.4', '', 'notaccept', true, true]], 12 | } 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /test/public/lhost-ezweb.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module EZweb 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.910', '', 'filtered', false, true]], 6 | '02' => [['5.0.0', '550', 'suspend', false, true]], 7 | '03' => [['5.0.921', '', 'suspend', false, true]], 8 | '04' => [['5.0.911', '550', 'userunknown', true, true]], 9 | '05' => [['5.0.947', '', 'expired', false, false]], 10 | '07' => [['5.0.911', '550', 'userunknown', true, true]], 11 | '08' => [['5.0.971', '550', 'blocked', false, false]], 12 | } 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /test/public/lhost-exchange2003.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Exchange2003 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.911', '', 'userunknown', true, true]], 6 | '02' => [['5.0.911', '', 'userunknown', true, true], 7 | ['5.0.911', '', 'userunknown', true, true]], 8 | '03' => [['5.0.911', '', 'userunknown', true, true]], 9 | '04' => [['5.0.910', '', 'filtered', false, false]], 10 | '05' => [['5.0.911', '', 'userunknown', true, true]], 11 | '07' => [['5.0.911', '', 'userunknown', true, true]], 12 | } 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /set-of-emails/maildir/tmp/rfc3464-38.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from r8-2.example.com (r8-2.example.com [207.115.63.49]) 3 | by w4-1.example.com (8.13.1/8.13.0) with ESMTP id m3TNYjK31707 4 | for ; Thu, 29 Apr 2008 23:34:45 +0000 5 | Received: (from root@localhost) 6 | by r8-2.example.com (8.13.1/8.13.0) id m3TNYjK00002 7 | for sironeko@example.org; Thu, 29 Apr 2008 23:34:45 +0000 8 | From: MAILER-DAEMON@example.com 9 | Message-Id: <20080429233445.m3TNYjK00000@r8-2.example.com> 10 | Date: Thu, 29 Apr 2008 23:34:45 +0000 11 | To: 12 | Subject: Returned mail: Nyaan 13 | 14 | User's mailbox is full: 15 | Unable to deliver mail. 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/public/lhost-amazonworkmail.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module AmazonWorkMail 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.2.1', '550', 'filtered', false, true]], 7 | '03' => [['5.3.5', '550', 'systemerror', false, false]], 8 | '04' => [['5.2.2', '550', 'mailboxfull', false, true]], 9 | '05' => [['4.4.2', '421', 'expired', false, false]], 10 | '07' => [['4.4.2', '421', 'expired', false, false]], 11 | '08' => [['5.2.2', '550', 'mailboxfull', false, true]], 12 | } 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /test/public/lhost-exchange2007.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Exchange2007 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.2.2', '550', 'mailboxfull', false, true]], 7 | '03' => [['5.2.3', '550', 'exceedlimit', false, false]], 8 | '04' => [['5.7.1', '550', 'securityerror', false, false]], 9 | '05' => [['4.4.1', '', 'expired', false, false]], 10 | '06' => [['5.1.1', '550', 'userunknown', true, true]], 11 | '07' => [['5.1.1', '550', 'userunknown', true, true]], 12 | } 13 | end 14 | end 15 | 16 | -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/lhost-imailserver-01.eml: -------------------------------------------------------------------------------- 1 | Date: Thu, 29 Apr 2009 23:45:10 -0600 Message-Id: <00000000000.fffffff@example.org> From: "Postmaster" Sender: To: Subject: Undeliverable Mail X-Mailer: Unknown user: kijitora@example.com Original message follows. Received: from example.org [192.0.2.88] by example.org with ESMTP (SMTPD32-5.05) id 000000000000 Thu, 29 Apr 2009 23:45:10 -0600 Message-ID: <00000000.ffffffff@example.org> Date: Thu, 29 Apr 2009 23:45:10 -0800 From: Karen Alton Reply-To: nekochan@example.org MIME-Version: 1.0 To: kijitora@example.com Subject: Nyaaan Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Nyaan -------------------------------------------------------------------------------- /test/public/rhost-google.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Google 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.2.1', '550', 'suspend', false, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '03' => [['5.7.26', '550', 'authfailure', false, false]], 8 | '04' => [['5.7.26', '550', 'authfailure', false, false]], 9 | '05' => [['5.2.2', '552', 'mailboxfull', false, true]], 10 | '06' => [['5.7.25', '550', 'requireptr', false, false]], 11 | '07' => [['5.2.1', '550', 'suspend', false, true]], 12 | '08' => [['5.7.1', '550', 'notcompliantrfc', false, false]], 13 | } 14 | end 15 | end 16 | 17 | -------------------------------------------------------------------------------- /test/public/lhost-receivingses.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module ReceivingSES 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '03' => [['4.0.0', '450', 'onhold', false, false]], 8 | '04' => [['5.2.2', '552', 'mailboxfull', false, true]], 9 | '05' => [['5.3.4', '552', 'mesgtoobig', false, false]], 10 | '06' => [['5.6.1', '500', 'spamdetected', false, false]], 11 | '07' => [['5.2.0', '550', 'filtered', false, true]], 12 | '08' => [['5.2.3', '552', 'exceedlimit', false, false]], 13 | } 14 | end 15 | end 16 | 17 | -------------------------------------------------------------------------------- /set-of-emails/to-be-parsed-for-test/README.md: -------------------------------------------------------------------------------- 1 | About Sample Emails in set-of-emails/to-be-parsed-for-test Directory 2 | ==================================================================== 3 | 4 | If you want to know whether the latest version of Sisimai ( both Perl version and 5 | Ruby version) can parse bounce emails you have or not, fork this repository and 6 | add these emails to this repository. 7 | 8 | ``` 9 | % cd /usr/local/src 10 | % git clone https://github.com/sisimai/set-of-emails.git 11 | ... 12 | 13 | % cd set-of-emails 14 | % git checkout -b add-emails-from- 15 | % cp /path/to/some/where/*.eml ./to-be-parsed-for-test/ 16 | % git add ./to-be-parsed-for-test/*.eml 17 | % git commit -m 'Your commit message here' ./to-be-parsed-for-test/ 18 | % git push origin master 19 | ``` 20 | 21 | -------------------------------------------------------------------------------- /test/private/lhost-x3.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module X3 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.3.0', '553', 'userunknown', true, true]], 6 | '1002' => [['5.0.900', '', 'undefined', false, false]], 7 | '1003' => [['5.0.947', '', 'expired', false, false]], 8 | '1004' => [['5.3.0', '553', 'userunknown', true, true]], 9 | '1005' => [['5.0.900', '', 'undefined', false, false]], 10 | '1006' => [['5.3.0', '553', 'userunknown', true, true]], 11 | '1007' => [['5.0.947', '', 'expired', false, false]], 12 | '1008' => [['5.3.0', '553', 'userunknown', true, true]], 13 | } 14 | end 15 | end 16 | 17 | -------------------------------------------------------------------------------- /test/private/lhost-mimecast.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Mimecast 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.4.1', '', 'userunknown', true, true]], 6 | '1002' => [['4.4.4', '', 'networkerror', false, false]], 7 | '1003' => [['5.1.1', '', 'userunknown', true, true]], 8 | '1004' => [['5.4.14', '554', 'networkerror', false, false]], 9 | '1005' => [['5.1.1', '550', 'userunknown', true, true]], 10 | '1006' => [['5.7.54', '550', 'norelaying', false, true]], 11 | '1007' => [['5.7.1', '550', 'blocked', false, false]], 12 | '1008' => [['5.2.1', '550', 'suspend', false, true]], 13 | } 14 | end 15 | end 16 | 17 | -------------------------------------------------------------------------------- /test/public/lhost-x2.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module X2 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.910', '', 'filtered', false, false]], 6 | '02' => [['5.0.910', '', 'filtered', false, false], 7 | ['5.0.921', '', 'suspend', false, true], 8 | ['5.0.910', '', 'filtered', false, false]], 9 | '03' => [['5.0.947', '', 'expired', false, false]], 10 | '04' => [['5.0.922', '', 'mailboxfull', false, false]], 11 | '05' => [['4.1.9', '', 'expired', false, false]], 12 | '06' => [['4.4.1', '', 'expired', false, false]], 13 | '07' => [['5.4.14', '554', 'networkerror', false, false]], 14 | } 15 | end 16 | end 17 | 18 | -------------------------------------------------------------------------------- /test/public/lhost-outlook.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Outlook 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | "01" => [["5.2.2", "550", "mailboxfull", false, true]], 6 | "02" => [["5.1.1", "550", "userunknown", true, true]], 7 | "03" => [["5.5.0", "554", "hostunknown", true, true]], 8 | "04" => [["5.1.1", "550", "userunknown", true, true], 9 | ["5.2.2", "550", "mailboxfull", false, true]], 10 | "06" => [["4.4.7", "", "expired", false, false]], 11 | "07" => [["4.4.7", "", "expired", false, false]], 12 | "08" => [["5.5.0", "550", "userunknown", true, true]], 13 | "09" => [["5.5.0", "550", "requireptr", false, false]], 14 | } 15 | end 16 | end 17 | 18 | -------------------------------------------------------------------------------- /test/public/rhost-outlook.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module Outlook 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.2.2', '550', 'mailboxfull', false, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '03' => [['5.5.0', '554', 'hostunknown', true, true]], 8 | '04' => [['5.1.1', '550', 'userunknown', true, true], 9 | ['5.2.2', '550', 'mailboxfull', false, true]], 10 | '06' => [['4.4.7', '', 'expired', false, false]], 11 | '07' => [['4.4.7', '', 'expired', false, false]], 12 | '08' => [['5.5.0', '550', 'userunknown', true, true]], 13 | '09' => [['5.5.0', '550', 'requireptr', false, false]], 14 | } 15 | end 16 | end 17 | 18 | -------------------------------------------------------------------------------- /test/private/lhost-mcafee.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module McAfee 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.911', '550', 'userunknown', true, true]], 6 | '1002' => [['5.0.910', '550', 'filtered', false, true]], 7 | '1003' => [['5.1.1', '550', 'userunknown', true, true]], 8 | '1004' => [['5.1.1', '550', 'userunknown', true, true]], 9 | '1005' => [['5.1.1', '550', 'userunknown', true, true]], 10 | '1006' => [['5.1.1', '550', 'userunknown', true, true]], 11 | '1007' => [['5.0.911', '550', 'userunknown', true, true]], 12 | '1008' => [['5.0.910', '550', 'filtered', false, true]], 13 | '1009' => [['5.0.910', '550', 'filtered', false, true]], 14 | } 15 | end 16 | end 17 | 18 | -------------------------------------------------------------------------------- /test/private/lhost-x1.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module X1 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.910', '', 'filtered', false, false]], 6 | '1002' => [['5.0.910', '', 'filtered', false, false], 7 | ['5.0.910', '', 'filtered', false, false]], 8 | '1003' => [['5.0.910', '', 'filtered', false, false]], 9 | '1004' => [['5.0.910', '', 'filtered', false, false]], 10 | '1005' => [['5.0.910', '', 'filtered', false, false]], 11 | '1006' => [['5.0.910', '', 'filtered', false, false]], 12 | '1007' => [['5.0.947', '', 'expired', false, false]], 13 | '1008' => [['5.0.921', '', 'suspend', false, true]], 14 | } 15 | end 16 | end 17 | 18 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-imailserver-01.eml: -------------------------------------------------------------------------------- 1 | Date: Thu, 29 Apr 2009 23:45:10 -0600 2 | Message-Id: <00000000000.fffffff@example.org> 3 | From: "Postmaster" 4 | Sender: 5 | To: 6 | Subject: Undeliverable Mail 7 | X-Mailer: 8 | 9 | Unknown user: kijitora@example.com 10 | 11 | 12 | Original message follows. 13 | 14 | Received: from example.org [192.0.2.88] by example.org with ESMTP 15 | (SMTPD32-5.05) id 000000000000 Thu, 29 Apr 2009 23:45:10 -0600 16 | Message-ID: <00000000.ffffffff@example.org> 17 | Date: Thu, 29 Apr 2009 23:45:10 -0800 18 | From: Karen Alton 19 | Reply-To: nekochan@example.org 20 | MIME-Version: 1.0 21 | To: kijitora@example.com 22 | Subject: Nyaaan 23 | Content-Type: text/plain; charset=us-ascii 24 | Content-Transfer-Encoding: 7bit 25 | 26 | Nyaan 27 | 28 | -------------------------------------------------------------------------------- /test/private/lhost-sendgrid.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module SendGrid 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '1002' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '1003' => [['5.0.947', '', 'expired', false, false]], 8 | '1004' => [['5.0.911', '550', 'userunknown', true, true]], 9 | '1005' => [['5.2.1', '550', 'userunknown', true, true]], 10 | '1006' => [['5.2.2', '550', 'mailboxfull', false, true]], 11 | '1007' => [['5.1.1', '550', 'userunknown', true, true]], 12 | '1008' => [['5.0.911', '554', 'userunknown', true, true]], 13 | '1009' => [['5.0.911', '550', 'userunknown', true, true]], 14 | } 15 | end 16 | end 17 | 18 | -------------------------------------------------------------------------------- /set-of-emails/maildir/dos/lhost-imailserver-01.eml: -------------------------------------------------------------------------------- 1 | Date: Thu, 29 Apr 2009 23:45:10 -0600 2 | Message-Id: <00000000000.fffffff@example.org> 3 | From: "Postmaster" 4 | Sender: 5 | To: 6 | Subject: Undeliverable Mail 7 | X-Mailer: 8 | 9 | Unknown user: kijitora@example.com 10 | 11 | 12 | Original message follows. 13 | 14 | Received: from example.org [192.0.2.88] by example.org with ESMTP 15 | (SMTPD32-5.05) id 000000000000 Thu, 29 Apr 2009 23:45:10 -0600 16 | Message-ID: <00000000.ffffffff@example.org> 17 | Date: Thu, 29 Apr 2009 23:45:10 -0800 18 | From: Karen Alton 19 | Reply-To: nekochan@example.org 20 | MIME-Version: 1.0 21 | To: kijitora@example.com 22 | Subject: Nyaaan 23 | Content-Type: text/plain; charset=us-ascii 24 | Content-Transfer-Encoding: 7bit 25 | 26 | Nyaan 27 | 28 | -------------------------------------------------------------------------------- /set-of-emails/maildir/tmp/rfc3464-39.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from r2.nyaan.example.net (www.nyaan.example.net [207.178.107.65]) 3 | by r8-5.neko.example.com (8.13.1/8.13.1) with ESMTP id l6TNYjZ31744 4 | for ; Thu, 29 Apr 2007 23:34:45 +0000 5 | Message-ID: 6 | From: Postmaster 7 | To: sironeko-nyaan@example.org 8 | Subject: Undeliverable: kijitora@nyaan.example.net 9 | Date: Wed, 3 May 2007 23:34:45 10 | MIME-Version: 1.0 11 | Content-Type: text/plain; charset="us-ascii" 12 | 13 | -------------------------------------------------------------------------------- 14 | Your Message 15 | 16 | To: 17 | 18 | Subject: Nyaan 19 | 20 | Date: Thu, 29 Apr 2007 23:34:45 +0000 21 | 22 | Did not reach the following recipient: kijitora@nyaan.example.net 23 | 24 | -------------------------------------------------------------------------------- /lib/sisimai/reason/delivered.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | module Reason 3 | # Sisimai::Reason::Delivered checks the email you sent is delivered successfully or not by matching 4 | # diagnostic messages with message patterns. Sisimai will set "delivered" to the value of "reason" 5 | # when Status: field in the bounce message begins with "2" like following: 6 | # 7 | # Final-Recipient: rfc822; kijitora@neko.nyaan.jp 8 | # Action: delivered 9 | # Status: 2.1.5 10 | # Diagnostic-Code: SMTP; 250 2.1.5 OK 11 | # 12 | # This class is called only Sisimai.reason method. This is NOT AN ERROR reason. 13 | module Delivered 14 | class << self 15 | def text; return 'delivered'; end 16 | def description; return 'Email delivered successfully'; end 17 | def match; return false; end 18 | def true(*); return false; end 19 | end 20 | end 21 | end 22 | end 23 | 24 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-imailserver-03.eml: -------------------------------------------------------------------------------- 1 | From <> Thu Apr 29 23:45:10 2008 2 | Date: Thu, 29 Apr 2008 23:45:10 -0500 3 | Message-Id: <00000000000.00000000000@neko.example.co.jp> 4 | Mime-Version: 1.0 5 | Content-Type: text/plain; charset=us-ascii 6 | From: "Postmaster" 7 | Sender: 8 | To: 9 | Subject: Undeliverable Mail 10 | X-Mailer: 11 | 12 | Invalid final delivery userid: kijitora@neko.example.co.jp 13 | 14 | 15 | Original message follows. 16 | 17 | Date: Thu, 29 Apr 2008 23:45:10 -0500 18 | Message-Id: <200804292345.00000000000@neko.example.co.jp> 19 | Mime-Version: 1.0 20 | Content-Type: text/plain; charset=us-ascii 21 | Reply-To: 22 | To: 23 | Subject: Nyaan 24 | X-Mailer: 25 | From: "Shironeko" 26 | 27 | Nyaan 28 | 29 | -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/rfc3834-01.eml: -------------------------------------------------------------------------------- 1 | Return-path: Envelope-to: neko@libsisimai.org Delivery-date: Thu, 29 Apr 2005 23:34:45 +0900 Received: from mta2.relay2.example.org ([192.0.2.222]:22222) by nyaan.example.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.81) (envelope-from ) id 2NEKOS-222222-22 for neko@libsisimai.org; Thu, 29 Apr 2005 23:34:45 +0900 Received: from neko.example.org (neko.soto.example.org [192.0.2.22]) by mta2.relay2.example.org (8.12.8/8.12.8) with ESMTP id j3QNaaaa222222 for ; Thu, 29 Apr 2005 23:34:45 +0900 Date: Thu, 29 Apr 2005 23:34:45 +0900 Message-Id: <200503142138.j3QNaaaa222222@neko.example.org> To: neko@libsisimai.org Auto-Submitted: auto-replied From: kijitora@example.net Subject: Away until May 5 I am currently away returning to the office on May 5th. I will have limited access to email and will respond to you upon my return. Kijitora, Nyaan. -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-03.eml: -------------------------------------------------------------------------------- 1 | Received: (qmail 1111 invoked for bounce); 29 Apr 2010 07:55:24 -0000 2 | Date: 29 Apr 2010 07:55:24 -0000 3 | From: MAILER-DAEMON@nijo.example.jp 4 | To: root@nijo.example.jp 5 | Subject: failure notice 6 | 7 | Hi. This is the qmail-send program at nijo.example.jp. 8 | I'm afraid I wasn't able to deliver your message to the following addresses. 9 | This is a permanent error; I've given up. Sorry it didn't work out. 10 | 11 | : 12 | Connected to 192.0.2.225 but sender was rejected. 13 | Remote host said: 550 5.7.1 ... Access denied 14 | 15 | --- Below this line is a copy of the message. 16 | 17 | Return-Path: 18 | Received: (qmail 8888 invoked by uid 0); 29 Apr 2010 07:55:23 -0000 19 | Date: 29 Apr 2010 07:55:23 -0000 20 | Message-ID: <00000000000000.5529.qmail@nijo.example.jp> 21 | From: root@nijo.example.jp 22 | To: kijitora@example.org 23 | -------------------------------------------------------------------------------- /lib/sisimai/fact/yaml.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | class Fact 3 | # Sisimai::Fact::YAML dumps decoded data object as a YAML format. This class and method should 4 | # be called from the parent object "Sisimai::Fact". 5 | module YAML 6 | class << self 7 | require 'yaml' 8 | 9 | # Serializer (YAML) 10 | # @param [Sisimai::Fact] argvs Object 11 | # @return [String, nil] Dumped data or nil if the argument is missing 12 | def dump(argvs) 13 | return "" if argvs.nil? || argvs.is_a?(Sisimai::Fact) == false 14 | 15 | damneddata = argvs.damn 16 | yamlstring = nil 17 | 18 | begin 19 | yamlstring = ::YAML.dump(damneddata) 20 | rescue StandardError => ce 21 | warn '***warning: Failed to YAML.dump: ' + ce.to_s 22 | end 23 | 24 | return yamlstring 25 | end 26 | 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/lhost-v5sendmail-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: Received: from mx1.example.com ([192.0.2.55]) by mx5.example.net (Post.Office MTA v3.1.2 release (FF000-0000) ID# 0-00000000000000000) with SMTP id 00000000 for ; Thu, 29 Apr 1998 23:34:45 -0700 Received: by mx5.example.com; (5.65/1.37) id 0000000; Sat, 29 Apr 1995 23:34:45 +0900 Date: Sat, 29 Apr 1995 23:34:45 +0900 From: Mail Delivery Subsystem Subject: Returned mail: Cannot send message for 4 days Message-Id: <0000000000.0000000@mx5.example.com> To: shironeko@example.co.jp ----- Transcript of session follows ----- 421 example.com (smtp)... Deferred: Connection timed out during user open with example.com ----- Unsent message follows ----- Received: by mx9.example.com; (5.65/1.37) id 0000000; Thu, 29 Apr 1995 23:34:45 +0900 From: shironeko@example.co.jp To: kijitora@example.com Subject: Nyaaan Nyaaaaaaaaaaaaaaaan -------------------------------------------------------------------------------- /test/private/lhost-notes.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Notes 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.911', '', 'userunknown', true, true]], 6 | '1002' => [['5.0.901', '', 'onhold', false, false]], 7 | '1003' => [['5.0.901', '', 'onhold', false, false]], 8 | '1004' => [['5.0.911', '', 'userunknown', true, true]], 9 | '1005' => [['5.0.901', '', 'onhold', false, false]], 10 | '1006' => [['5.0.911', '', 'userunknown', true, true]], 11 | '1007' => [['5.0.911', '', 'userunknown', true, true]], 12 | '1008' => [['5.0.911', '', 'userunknown', true, true]], 13 | '1009' => [['5.0.911', '', 'userunknown', true, true]], 14 | '1010' => [['5.0.944', '', 'networkerror', false, false]], 15 | } 16 | end 17 | end 18 | 19 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-07.eml: -------------------------------------------------------------------------------- 1 | From MAILER-DAEMON Fri Jan 1 00:0:00 2015 2 | Return-Path: <> 3 | X-Original-To: shironeko@example.ad.jp 4 | Delivered-To: shironeko@example.ad.jp 5 | Received: from host (mta1) 6 | by mta.example.jp (Postfix) with SMTP id F00000 7 | for shironeko@example.ad.jp; Fri, 1 Jan 2015 00:00:00 +0900 (JST) 8 | Received: (qmail host invoked for bounce); 1 Jan 2015 00:00:00 +0900 9 | Date: 1 Jan 2015 00:00:00 +0900 10 | From: MAILER-DAEMON@example.jp 11 | To: shironeko@example.ad.jp 12 | Subject: failure notice 13 | 14 | Hi. This is the qmail-send program at MTA. 15 | I'm afraid I wasn't able to deliver your message to the following addresses. 16 | This is a permanent error; I've given up. Sorry it didn't work out. 17 | 18 | : 19 | Sorry, I wasn't able to establish an SMTP connection. (#4.4.1) 20 | I'm not going to try again; this message has been in the queue too long. 21 | 22 | --- Below this line is a copy of the message. 23 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-08.eml: -------------------------------------------------------------------------------- 1 | From MAILER-DAEMON Mon Jan 1 00:00:00 2015 2 | Return-Path: <> 3 | X-Original-To: shironeko@example.ad.jp 4 | Delivered-To:shironeko@example.ad.jp 5 | Received: from mta.example.jp 6 | by mx.example.jp (Postfix) with SMTP id ffffffff 7 | for ; Mon, 1 Jan 2015 00:00:00 +0900 (JST) 8 | Received: (qmail 7120 invoked for bounce); 1 Jan 2015 00:00:00 +0900 9 | Date: 1 Jan 2015 00:00:00 +0900 10 | From: MAILER-DAEMON@example.ad.jp 11 | To: shironeko@example.ad.jp 12 | Subject: failure notice 13 | 14 | Hi. This is the qmail-send program at example.ad.jp. 15 | I'm afraid I wasn't able to deliver your message to the following addresses. 16 | This is a permanent error; I've given up. Sorry it didn't work out. 17 | 18 | : 19 | 192.0.2.1 does not like recipient. 20 | Remote host said: 552 Error: disk quota exceeded 21 | Giving up on 192.0.2.20. 22 | 23 | --- Below this line is a copy of the message. 24 | -------------------------------------------------------------------------------- /set-of-emails/maildir/err/make-test-07.eml: -------------------------------------------------------------------------------- 1 | Received: (qmail 3622 invoked for bounce); 30 Mar 2009 08:18:21 -0000 2 | Date: 30 Mar 2009 08:18:21 -0000 3 | From: MAILER-DAEMON@example.co.jp 4 | To: root@psuketarozaemon.jp 5 | Subject: failure notice 6 | 7 | Hi. This is the qmail-send program at mta.example.co.jp 8 | I'm afraid I wasn't able to deliver your message to the following addresses. 9 | This is a permanent error; I've given up. Sorry it didn't work out. 10 | 11 | : 12 | 192.0.2.135 does not like recipient. 13 | Remote host said: 550 5.1.1 ... User Unknown 14 | Giving up on 192.0.2.135. 15 | 16 | --- Below this line is a copy of the message. 17 | 18 | Return-Path: 19 | Received: (qmail 3620 invoked by uid 0); 30 Mar 2009 08:18:19 -0000 20 | Date: 30 Mar 2009 08:18:19 -0000 21 | Message-ID: <20090330081819.3619.qmail@mta.example.co.jp> 22 | From: root@example.co.jp 23 | to: userunknown@example.com 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/lhost-verizon-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> Received: from njbrspamp1.vtext.com (njbrspamp1.vtext.com [192.0.2.146]) by nijo.example.jp (V8/cf) with ESMTP id r5KATqOU002339 for ; Thu, 20 Jun 2013 06:29:53 -0400 Received: from 39.example.com (HELO m01.vzwpix.com) ([192.0.2.39]) by njbrspamp1.vtext.com with SMTP; 20 Jun 2013 10:29:52 +0000 From:MMSC NDR Administrator To:kijitora@example.jp Subject:Undeliverable Message Message-ID: <212238484192055707@-212238484192055708> Date: Wed, 20 Jun 2013 10:29:52 +0000 Content-Type: multipart/mixed; boundary="----=ThisIsTheBoundaryStringaaa" ------=ThisIsTheBoundaryStringaaa Content-Type: text/plain; charset=US-ASCII Message could not be delivered to mobile. Error: No valid recipients for this MM Original Message: From: azumakuniyuki To: 0000000000@vzwpix.com Subject: test for bounce Date: Wed, 20 Jun 2013 10:29:52 +0000 ------=ThisIsTheBoundaryStringaaa-- Content-Type: text/plain -------------------------------------------------------------------------------- /test/public/lhost-mailru.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module MailRu 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.2.2', '550', 'mailboxfull', false, true]], 7 | '03' => [['5.2.2', '550', 'mailboxfull', false, true], 8 | ['5.2.1', '550', 'userunknown', true, true]], 9 | '04' => [['5.1.1', '550', 'userunknown', true, true]], 10 | '05' => [['5.0.932', '', 'notaccept', true, true]], 11 | '06' => [['5.0.912', '', 'hostunknown', true, true]], 12 | '07' => [['5.0.910', '550', 'filtered', false, true]], 13 | '08' => [['5.0.911', '550', 'userunknown', true, true]], 14 | '09' => [['5.1.8', '501', 'rejected', false, false]], 15 | '10' => [['4.0.947', '', 'expired', false, false]], 16 | } 17 | end 18 | end 19 | 20 | -------------------------------------------------------------------------------- /test/public/rhost-franceptt.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module FrancePTT 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.5.0', '550', 'userunknown', true, true]], 7 | '03' => [['5.2.0', '550', 'spamdetected', false, false]], 8 | '04' => [['5.2.0', '550', 'spamdetected', false, false]], 9 | '05' => [['5.5.0', '550', 'suspend', false, true]], 10 | '06' => [['4.0.0', '', 'blocked', false, false]], 11 | '07' => [['4.0.0', '421', 'toomanyconn', false, false]], 12 | '08' => [['4.2.0', '421', 'systemerror', false, false]], 13 | '10' => [['5.5.0', '550', 'blocked', false, false]], 14 | '11' => [['4.2.1', '421', 'requireptr', false, false]], 15 | '12' => [['5.7.1', '554', 'policyviolation', false, false]], 16 | } 17 | end 18 | end 19 | 20 | -------------------------------------------------------------------------------- /test/private/lhost-yahoo.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Yahoo 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '1002' => [['5.2.2', '550', 'mailboxfull', false, true]], 7 | '1003' => [['5.2.1', '550', 'userunknown', true, true]], 8 | '1004' => [['5.1.1', '550', 'userunknown', true, true]], 9 | '1005' => [['5.0.971', '554', 'blocked', false, false]], 10 | '1006' => [['5.0.911', '550', 'userunknown', true, true]], 11 | '1007' => [['5.2.2', '550', 'mailboxfull', false, true]], 12 | '1008' => [['5.0.932', '', 'notaccept', true, true]], 13 | '1009' => [['5.1.1', '550', 'userunknown', true, true]], 14 | '1010' => [['5.1.8', '501', 'rejected', false, false]], 15 | '1011' => [['5.0.971', '554', 'blocked', false, false]], 16 | } 17 | end 18 | end 19 | 20 | -------------------------------------------------------------------------------- /test/private/lhost-mxlogic.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module MXLogic 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '1002' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '1003' => [['5.1.1', '550', 'userunknown', true, true]], 8 | '1004' => [['5.1.1', '550', 'userunknown', true, true]], 9 | '1005' => [['5.1.1', '550', 'userunknown', true, true]], 10 | '1006' => [['5.1.1', '550', 'userunknown', true, true]], 11 | '1007' => [['5.1.1', '550', 'userunknown', true, true]], 12 | '1008' => [['5.1.1', '550', 'userunknown', true, true]], 13 | '1009' => [['5.1.1', '550', 'userunknown', true, true]], 14 | '1010' => [['5.0.910', '550', 'filtered', false, true]], 15 | '1011' => [['5.0.910', '550', 'filtered', false, true]], 16 | } 17 | end 18 | end 19 | 20 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/rfc3834-01.eml: -------------------------------------------------------------------------------- 1 | Return-path: 2 | Envelope-to: neko@libsisimai.org 3 | Delivery-date: Thu, 29 Apr 2005 23:34:45 +0900 4 | Received: from mta2.relay2.example.org ([192.0.2.222]:22222) 5 | by nyaan.example.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) 6 | (Exim 4.81) 7 | (envelope-from ) 8 | id 2NEKOS-222222-22 9 | for neko@libsisimai.org; Thu, 29 Apr 2005 23:34:45 +0900 10 | Received: from neko.example.org (neko.soto.example.org [192.0.2.22]) 11 | by mta2.relay2.example.org (8.12.8/8.12.8) with ESMTP id j3QNaaaa222222 12 | for ; Thu, 29 Apr 2005 23:34:45 +0900 13 | Date: Thu, 29 Apr 2005 23:34:45 +0900 14 | Message-Id: <200503142138.j3QNaaaa222222@neko.example.org> 15 | To: neko@libsisimai.org 16 | Auto-Submitted: auto-replied 17 | From: kijitora@example.net 18 | Subject: Away until May 5 19 | 20 | I am currently away returning to the office on May 5th. I will have limited access to email and will respond to you upon my return. 21 | 22 | Kijitora, Nyaan. 23 | 24 | -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/lhost-exchange-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> Received: from gw.example.com ([192.0.2.23]) by gw2.ext.example.net (Post.Office MTA v0.0.0 release (P0000-000x) ID# 0-00000000000000000) with ESMTP id 0000001 for ; Thu, 29 Apr 2010 00:00:00 -0000 Received: by gw with Internet Mail Service (5.5.1960.3) id <00000000>; Thu, 29 Apr 2010 00:00:00 -0000 Message-ID: <00000000000000000000000000000000000000@gw.example.com> From: System Administrator To: shironeko@example.com Subject: Undeliverable: Kijitora Cat Date: Thu, 29 Apr 2010 00:00:00 -0000 X-MS-TNEF-Correlator: <00000000000000000000000000000000000000@example.com> X-Mailer: Internet Mail Service (5.5.1960.3) X-MS-Embedded-Report: Your message To: shironeko@example.com Subject: Kijitora Cat Sent: Thu, 29 Apr 2010 00:00:00 -0000 did not reach the following recipient(s): kijitora@example.jp on Thu, 29 Apr 2010 00:00:00 -0000 The recipient name is not recognized MSEXCH:IMS:NNN:KIJITORACAT:NEKO 0 (000C05A6) Unknown Recipient -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/lhost-exchange2003-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> Received: from gw.example.com ([192.0.2.23]) by gw2.ext.example.net (Post.Office MTA v0.0.0 release (P0000-000x) ID# 0-00000000000000000) with ESMTP id 0000001 for ; Thu, 29 Apr 2010 00:00:00 -0000 Received: by gw with Internet Mail Service (5.5.1960.3) id <00000000>; Thu, 29 Apr 2010 00:00:00 -0000 Message-ID: <00000000000000000000000000000000000000@gw.example.com> From: System Administrator To: shironeko@example.com Subject: Undeliverable: Kijitora Cat Date: Thu, 29 Apr 2010 00:00:00 -0000 X-MS-TNEF-Correlator: <00000000000000000000000000000000000000@example.com> X-Mailer: Internet Mail Service (5.5.1960.3) X-MS-Embedded-Report: Your message To: shironeko@example.com Subject: Kijitora Cat Sent: Thu, 29 Apr 2010 00:00:00 -0000 did not reach the following recipient(s): kijitora@example.jp on Thu, 29 Apr 2010 00:00:00 -0000 The recipient name is not recognized MSEXCH:IMS:NNN:KIJITORACAT:NEKO 0 (000C05A6) Unknown Recipient -------------------------------------------------------------------------------- /test/public/time-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'sisimai/time' 3 | 4 | class TimeTest < Minitest::Test 5 | Methods = { class: %w[new], object: %w[to_json] } 6 | 7 | def test_methods 8 | Methods[:class].each { |e| assert_respond_to Sisimai::Time, e } 9 | Methods[:object].each { |e| assert_respond_to Sisimai::Time.new, e } 10 | end 11 | 12 | def test_new 13 | assert_instance_of Sisimai::Time, Sisimai::Time.new 14 | assert_instance_of Sisimai::Time, Sisimai::Time.new(22) 15 | 16 | if false 17 | # TODO: TEST ON Ruby 2.7 18 | ce = assert_raises TypeError do 19 | Sisimai::Time.new(nil, nil) 20 | end 21 | assert_match /(?:no implicit conversion from nil to integer|invalid month|invalid year)/, ce.to_s 22 | 23 | ce = assert_raises NoMethodError do 24 | Sisimai::Time.new(nil) 25 | end 26 | assert_match /undefined method/, ce.to_s 27 | end 28 | end 29 | 30 | def test_to_json 31 | cv = Sisimai::Time.new 32 | assert_instance_of Integer, cv.to_json 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /set-of-emails/maildir/dos/rfc3834-01.eml: -------------------------------------------------------------------------------- 1 | Return-path: 2 | Envelope-to: neko@libsisimai.org 3 | Delivery-date: Thu, 29 Apr 2005 23:34:45 +0900 4 | Received: from mta2.relay2.example.org ([192.0.2.222]:22222) 5 | by nyaan.example.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) 6 | (Exim 4.81) 7 | (envelope-from ) 8 | id 2NEKOS-222222-22 9 | for neko@libsisimai.org; Thu, 29 Apr 2005 23:34:45 +0900 10 | Received: from neko.example.org (neko.soto.example.org [192.0.2.22]) 11 | by mta2.relay2.example.org (8.12.8/8.12.8) with ESMTP id j3QNaaaa222222 12 | for ; Thu, 29 Apr 2005 23:34:45 +0900 13 | Date: Thu, 29 Apr 2005 23:34:45 +0900 14 | Message-Id: <200503142138.j3QNaaaa222222@neko.example.org> 15 | To: neko@libsisimai.org 16 | Auto-Submitted: auto-replied 17 | From: kijitora@example.net 18 | Subject: Away until May 5 19 | 20 | I am currently away returning to the office on May 5th. I will have limited access to email and will respond to you upon my return. 21 | 22 | Kijitora, Nyaan. 23 | 24 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-v5sendmail-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from mx1.example.com ([192.0.2.55]) 3 | by mx5.example.net (Post.Office MTA v3.1.2 release (FF000-0000) ID# 0-00000000000000000) 4 | with SMTP id 00000000 for ; 5 | Thu, 29 Apr 1998 23:34:45 -0700 6 | Received: by mx5.example.com; (5.65/1.37) id 0000000; 7 | Sat, 29 Apr 1995 23:34:45 +0900 8 | Date: Sat, 29 Apr 1995 23:34:45 +0900 9 | From: Mail Delivery Subsystem 10 | Subject: Returned mail: Cannot send message for 4 days 11 | Message-Id: <0000000000.0000000@mx5.example.com> 12 | To: shironeko@example.co.jp 13 | 14 | ----- Transcript of session follows ----- 15 | 421 example.com (smtp)... Deferred: Connection timed out during user open with example.com 16 | 17 | ----- Unsent message follows ----- 18 | Received: by mx9.example.com; (5.65/1.37) id 0000000; 19 | Thu, 29 Apr 1995 23:34:45 +0900 20 | From: shironeko@example.co.jp 21 | To: kijitora@example.com 22 | Subject: Nyaaan 23 | 24 | Nyaaaaaaaaaaaaaaaan 25 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-04.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0724 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:15:33 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:15:33 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | DNS lookup failure: host cx.libsisimai.org not found 17 | 18 | Message headers follow. 19 | 20 | Received: from root (uid 0) 21 | (envelope-from kijitora@df.example.jp) 22 | id e0722 23 | by df.example.jp (DragonFly Mail Agent v0.13); 24 | Tue, 11 Jun 2024 18:15:33 +0900 25 | Subject: Nyaan 01 26 | To: 27 | User-Agent: mail (GNU Mailutils 3.14) 28 | Date: Tue, 11 Jun 2024 18:15:33 +0900 29 | Message-Id: <666815b5.e0722.4e479ce6@df.example.jp> 30 | From: 31 | 32 | -------------------------------------------------------------------------------- /set-of-emails/maildir/dos/lhost-v5sendmail-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from mx1.example.com ([192.0.2.55]) 3 | by mx5.example.net (Post.Office MTA v3.1.2 release (FF000-0000) ID# 0-00000000000000000) 4 | with SMTP id 00000000 for ; 5 | Thu, 29 Apr 1998 23:34:45 -0700 6 | Received: by mx5.example.com; (5.65/1.37) id 0000000; 7 | Sat, 29 Apr 1995 23:34:45 +0900 8 | Date: Sat, 29 Apr 1995 23:34:45 +0900 9 | From: Mail Delivery Subsystem 10 | Subject: Returned mail: Cannot send message for 4 days 11 | Message-Id: <0000000000.0000000@mx5.example.com> 12 | To: shironeko@example.co.jp 13 | 14 | ----- Transcript of session follows ----- 15 | 421 example.com (smtp)... Deferred: Connection timed out during user open with example.com 16 | 17 | ----- Unsent message follows ----- 18 | Received: by mx9.example.com; (5.65/1.37) id 0000000; 19 | Thu, 29 Apr 1995 23:34:45 +0900 20 | From: shironeko@example.co.jp 21 | To: kijitora@example.com 22 | Subject: Nyaaan 23 | 24 | Nyaaaaaaaaaaaaaaaan 25 | -------------------------------------------------------------------------------- /set-of-emails/maildir/not/is-not-bounce-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from haineko.example.jp (c135.kyoto.example.ne.jp. [192.0.2.135]) 3 | by mx.example.com with ESMTPSA id uj1sm5989012pac.21.2013.07.15.13.16.37 4 | for 5 | (version=TLSv1 cipher=RC4-SHA bits=128/128); 6 | Mon, 15 Jul 2013 13:16:38 -0700 (PDT) 7 | Received: from [127.0.0.1] ([127.0.0.1]) by haineko.example.jp with HTTP id 8 | r6G5GZa04810SOeg; Tue, 16 Jul 2013 05:16:35 JST 9 | To: kijitora@example.jp 10 | Subject: =?UTF-8?B?44Gr44KD44KT44GT?= 11 | X-SMTP-Engine: Haineko 0.0.1 12 | X-Originating-IP: 127.0.0.1 13 | X-Mailer: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 14 | OpenSSL/0.9.8x zlib/1.2.5 15 | Reply-to: mikeneko@example.org 16 | X-HTTP-Referer: 17 | Date: Mon, 15 Jul 2013 13:16:38 -0700 (PDT) 18 | Message-Id: <51e458a6.21eb420a.5f83.4ce2@mx.example.com> 19 | From: Kijitora 20 | MIME-Version: 1.0 21 | Content-Type: text/plain; charset="UTF-8" 22 | Content-Transfer-Encoding: 8bit 23 | 24 | にゃーーーーーーーーーーー 25 | 26 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-30.eml: -------------------------------------------------------------------------------- 1 | From MAILER-DAEMON Sun Jun 16 18:15:07 2024 2 | Received: from MAILER-DAEMON 3 | id e070f 4 | by df.example.jp (DragonFly Mail Agent v0.13); 5 | Sun, 16 Jun 2024 18:15:07 +0900 6 | X-Original-To: 7 | From: MAILER-DAEMON <> 8 | To: kijitora@df.example.jp 9 | Subject: Mail delivery failed 10 | Message-Id: 11 | Date: Sun, 16 Jun 2024 18:15:07 +0900 12 | 13 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 14 | 15 | There was an error delivering your mail to . 16 | 17 | Could not deliver for the last 432000 seconds. Giving up. 18 | 19 | Message headers follow. 20 | 21 | Received: from kijitora (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e06d1 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:11:33 +0900 26 | Subject: Nyaan 02 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:11:33 +0900 30 | Message-Id: <666814c5.e06d1.45bde26c@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-v5sendmail-02.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from mx5.example.com ([192.0.2.50]) 3 | by mx5.r.example.com (Post.Office MTA v3.1.2 4 | release (FF000-0000) ID# 0-00000000000000000) 5 | with SMTP id 0000000 for ; 6 | Thu, 29 Apr 1998 23:34:45 +0900 7 | Received: by mx5.example.com; (5.65/1.37) id 0000000; 8 | Thu, 29 Sep 1998 23:34:45 +0900 9 | Date: Thu, 29 Sep 1998 23:34:45 +0900 10 | From: Mail Delivery Subsystem 11 | Subject: Returned mail: Host unknown 12 | Message-Id: <0000000000.0000000@mx5.example.com> 13 | To: shironeko@example.jp 14 | 15 | ----- Transcript of session follows ----- 16 | 550 neko.example.org (smtp)... 550 Host unknown 17 | 554 ... 550 Host unknown (Authoritative answer from name server) 18 | 19 | ----- Unsent message follows ----- 20 | Received: by mx5.example.com; (5.65/1.37) id 0000000; 21 | Wed, 27 Sep 1998 23:34:45 +0900 22 | From: shironeko@example.jp 23 | To: kijitora@neko.example.org 24 | Subject: Nyaaan 25 | 26 | Nyaaan 27 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/rfc3834-02.eml: -------------------------------------------------------------------------------- 1 | Return-path: <> 2 | Envelope-to: kijitora@example.com 3 | Delivery-date: Thu, 17 Jul 2013 23:34:45 -0500 4 | Received: from smtpd-02.example.com ([203.0.113.1]:2202) 5 | by neko2.example.com with esmtp (Exim 4.80) 6 | id 2Aeeee-00002R-AA 7 | for kijitora@example.com; Thu, 17 Jul 2013 23:34:45 -0500 8 | Received: from neko.nyaan.example.net ([fe80::ffff:ffff:ffff:0000%22]) by 9 | neko1.nyaan2.example.net ([fe80::0000:0000:0000:ffff%22]) with Microsoft 10 | SMTP Server id 14.02.0318.004; Thu, 17 Jul 2013 23:34:45 -0400 11 | From: "Neko, Nyaan" 12 | To: Kijitora 13 | Subject: Automatic reply: Nyaan 14 | Date: Thu, 17 Jul 2013 23:34:45 +0000 15 | Message-ID: 16 | X-Auto-Response-Suppress: All 17 | X-MS-Exchange-Inbox-Rules-Loop: nekonyaan@example.org 18 | X-MS-TNEF-Correlator: 19 | Content-Type: text/plain; charset="us-ascii" 20 | Content-Transfer-Encoding: quoted-printable 21 | MIME-Version: 1.0 22 | 23 | I'm out of the office Friday. For pressing news matters, Nyaan. 24 | 25 | -------------------------------------------------------------------------------- /test/private/lhost-courier.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Courier 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.0', '550', 'userunknown', true, true]], 6 | '1002' => [['5.0.0', '550', 'userunknown', true, true]], 7 | '1003' => [['5.7.1', '550', 'rejected', false, false]], 8 | '1004' => [['5.0.0', '550', 'userunknown', true, true]], 9 | '1005' => [['5.1.1', '550', 'userunknown', true, true]], 10 | '1006' => [['5.1.1', '550', 'userunknown', true, true]], 11 | '1007' => [['5.0.0', '550', 'userunknown', true, true]], 12 | '1008' => [['5.1.1', '550', 'userunknown', true, true]], 13 | '1009' => [['5.0.0', '550', 'filtered', false, true]], 14 | '1010' => [['5.7.1', '550', 'rejected', false, false]], 15 | '1011' => [['5.0.0', '', 'hostunknown', true, true]], 16 | '1012' => [['5.0.0', '', 'hostunknown', true, true]], 17 | } 18 | end 19 | end 20 | 21 | -------------------------------------------------------------------------------- /test/private/lhost-mailru.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module MailRu 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.911', '', 'userunknown', true, true]], 6 | '1002' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '1003' => [['5.2.2', '550', 'mailboxfull', false, true]], 8 | '1004' => [['5.2.2', '550', 'mailboxfull', false, true], 9 | ['5.2.1', '550', 'userunknown', true, true]], 10 | '1005' => [['5.0.910', '', 'filtered', false, false]], 11 | '1006' => [['5.2.2', '550', 'mailboxfull', false, true]], 12 | '1007' => [['5.0.911', '', 'userunknown', true, true]], 13 | '1008' => [['5.1.1', '550', 'userunknown', true, true]], 14 | '1009' => [['5.0.910', '550', 'filtered', false, true]], 15 | '1010' => [['5.0.911', '550', 'userunknown', true, true]], 16 | '1011' => [['5.1.8', '501', 'rejected', false, false]], 17 | } 18 | end 19 | end 20 | 21 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-11.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Delivered-To: nyaaaaan@nq.example.jp 3 | Received: (qmail 44378 invoked by alias); 24 Jun 2024 08:48:01 -0000 4 | Delivered-To: kijitora@nq.example.jp 5 | Received: (qmail 44375 invoked for bounce); 24 Jun 2024 08:48:01 -0000 6 | Date: 24 Jun 2024 08:48:01 -0000 7 | From: MAILER-DAEMON@nq.example.jp 8 | To: kijitora@nq.example.jp 9 | Subject: failure notice 10 | 11 | Hi. This is the qmail-send program at nq.example.jp. 12 | I'm afraid I wasn't able to deliver your message to the following addresses. 13 | This is a permanent error; I've given up. Sorry it didn't work out. 14 | 15 | : 16 | Sorry, I couldn't find a mail exchanger or IP address. (#5.4.4) 17 | 18 | --- Below this line is a copy of the message. 19 | 20 | Return-Path: 21 | Received: (qmail 44372 invoked by uid 0); 24 Jun 2024 08:48:01 -0000 22 | Date: 24 Jun 2024 08:48:01 -0000 23 | Message-ID: <20240624084801.44371.qmail@nq.example.jp> 24 | From: kijitora@nq.example.jp 25 | To: neko@nyaan.jp 26 | Subject: Nyaan? 27 | 28 | Nyaaaaaan 29 | 30 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-12.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Delivered-To: nyaaaaan@nq.example.jp 3 | Received: (qmail 44416 invoked by alias); 24 Jun 2024 08:50:01 -0000 4 | Delivered-To: kijitora@nq.example.jp 5 | Received: (qmail 44413 invoked for bounce); 24 Jun 2024 08:50:01 -0000 6 | Date: 24 Jun 2024 08:50:01 -0000 7 | From: MAILER-DAEMON@nq.example.jp 8 | To: kijitora@nq.example.jp 9 | Subject: failure notice 10 | 11 | Hi. This is the qmail-send program at nq.example.jp. 12 | I'm afraid I wasn't able to deliver your message to the following addresses. 13 | This is a permanent error; I've given up. Sorry it didn't work out. 14 | 15 | : 16 | Sorry, I couldn't find a mail exchanger or IP address. (#5.4.4) 17 | 18 | --- Below this line is a copy of the message. 19 | 20 | Return-Path: 21 | Received: (qmail 44410 invoked by uid 0); 24 Jun 2024 08:50:01 -0000 22 | Date: 24 Jun 2024 08:50:01 -0000 23 | Message-ID: <20240624085001.44409.qmail@nq.example.jp> 24 | From: kijitora@nq.example.jp 25 | To: nyaan@example.jp 26 | Subject: Nyaan? 27 | 28 | Nyaaaaaan 29 | 30 | -------------------------------------------------------------------------------- /test/private/lhost-activehunter.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Activehunter 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.910', '550', 'filtered', false, true]], 6 | '1002' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '1003' => [['5.3.0', '553', 'filtered', false, true]], 8 | '1004' => [['5.7.17', '550', 'filtered', false, true]], 9 | '1005' => [['5.1.1', '550', 'userunknown', true, true]], 10 | '1006' => [['5.1.1', '550', 'userunknown', true, true]], 11 | '1007' => [['5.0.910', '550', 'filtered', false, true]], 12 | '1008' => [['5.0.910', '550', 'filtered', false, true]], 13 | '1009' => [['5.1.1', '550', 'userunknown', true, true]], 14 | '1010' => [['5.3.0', '553', 'filtered', false, true]], 15 | '1011' => [['5.7.17', '550', 'filtered', false, true]], 16 | '1012' => [['5.1.1', '550', 'userunknown', true, true]], 17 | } 18 | end 19 | end 20 | 21 | -------------------------------------------------------------------------------- /test/public/smtp-trascript-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'sisimai/smtp/transcript' 3 | require 'sisimai/mail' 4 | 5 | class SMTPTranscriptTest < Minitest::Test 6 | Methods = { class: %w[rise] } 7 | EmailFp = 'set-of-emails/maildir/bsd/lhost-postfix-75.eml' 8 | 9 | def test_methods 10 | Methods[:class].each { |e| assert_respond_to Sisimai::SMTP::Transcript, e } 11 | end 12 | 13 | def test_code 14 | mailobject = Sisimai::Mail.new(EmailFp) 15 | entiremesg = mailobject.read.sub(/\A.+?\n\n(.+)\z/m, '\1') 16 | transcript = Sisimai::SMTP::Transcript.rise(entiremesg, 'In:', 'Out:') 17 | resmtpcomm = %r/(?:CONN|HELO|EHLO|AUTH|MAIL|RCPT|DATA|QUIT|RSET|X[A-Z]+)/; 18 | 19 | assert_instance_of Array, transcript 20 | assert_equal true, transcript.size > 0 21 | 22 | transcript.each do |e| 23 | v = e['command'] 24 | assert_match resmtpcomm, v 25 | 26 | end 27 | 28 | ce = assert_raises ArgumentError do 29 | Sisimai::SMTP::Transcript.rise(nil, nil, nil, nil) 30 | end 31 | assert_nil Sisimai::SMTP::Transcript.rise('') 32 | 33 | end 34 | 35 | end 36 | 37 | 38 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-imailserver-06.eml: -------------------------------------------------------------------------------- 1 | Date: Thu, 29 Apr 2008 14:45:56 +0900 2 | Message-Id: <1001011111.FF00134@mail.example.com> 3 | Mime-Version: 1.0 4 | Content-Type: text/plain; charset=us-ascii 5 | From: "Postmaster" 6 | Sender: 7 | To: 8 | Subject: Undeliverable Mail 9 | X-Mailer: 10 | X-RCPT-TO: 11 | Status: 12 | X-UIDL: 000000000 13 | X-IMail-ThreadID: 0000000000000000 14 | 15 | Save to the following Address Book: 16 | 17 | To: shironeko@neko.example.com 18 | CC: 19 | Date: Thursday, Apr 29, 2008 2:45:56 PM 20 | Subject: Undeliverable Mail 21 | 22 | undeliverable to kijitora@example.jp 23 | 24 | Body of message generated response: 25 | 550-REJECTED - Blacklisted URL in message. (example.com) in [black]. 26 | 550-See http://lookup.uribl.com. - Blacklisted Link - X=pascal 27 | 550-H=mail.example.com [192.0.2.11] HELO=[mail.example.com] 28 | 550-F=[shironeko@neko.example.com] T=[kijitora@example.jp] S=[HOT 29 | 550 DEALS UPDATE - 04/29/08 (Special Update - Family Sale) 30 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-29.eml: -------------------------------------------------------------------------------- 1 | From MAILER-DAEMON Sun Jun 16 18:30:26 2024 2 | Received: from MAILER-DAEMON 3 | id e06d1 4 | by df.example.jp (DragonFly Mail Agent v0.13); 5 | Sun, 16 Jun 2024 18:30:26 +0900 6 | X-Original-To: 7 | From: MAILER-DAEMON <> 8 | To: kijitora@df.example.jp 9 | Subject: Mail delivery failed 10 | Message-Id: 11 | Date: Sun, 16 Jun 2024 18:30:26 +0900 12 | 13 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 14 | 15 | There was an error delivering your mail to . 16 | 17 | Could not deliver for the last 432000 seconds. Giving up. 18 | 19 | Message headers follow. 20 | 21 | Received: from kijitora (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0724 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:27:33 +0900 26 | Subject: Nyaan 02 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:27:33 +0900 30 | Message-Id: <66681885.e0724.329a3871@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /lib/sisimai/reason/vacation.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | module Reason 3 | # Sisimai::Reason::Vacation is for only returning text and description. This class is called only 4 | # from Sisimai.reason method. 5 | module Vacation 6 | class << self 7 | Index = [ 8 | 'i am away on vacation', 9 | 'i am away until', 10 | 'i am out of the office', 11 | 'i will be traveling for work on', 12 | ].freeze 13 | 14 | def text; return 'vacation'; end 15 | def description; return 'Email replied automatically due to a recipient is out of office'; end 16 | 17 | # Try to match that the given text and regular expressions 18 | # @param [String] argv1 String to be matched with regular expressions 19 | # @return [Boolean] false: Did not match, true: Matched 20 | def match(argv1) 21 | return false if argv1.nil? || argv1.empty? 22 | return true if Index.any? { |a| argv1.include?(a) } 23 | return false 24 | end 25 | 26 | def true(*); return false; end 27 | end 28 | end 29 | end 30 | end 31 | 32 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-verizon-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Received: from njbrspamp1.vtext.com (njbrspamp1.vtext.com [192.0.2.146]) 3 | by nijo.example.jp (V8/cf) with ESMTP id r5KATqOU002339 4 | for ; Thu, 20 Jun 2013 06:29:53 -0400 5 | Received: from 39.example.com (HELO m01.vzwpix.com) ([192.0.2.39]) 6 | by njbrspamp1.vtext.com with SMTP; 20 Jun 2013 10:29:52 +0000 7 | From:MMSC NDR Administrator 8 | To:kijitora@example.jp 9 | Subject:Undeliverable Message 10 | Message-ID: <212238484192055707@-212238484192055708> 11 | Date: Wed, 20 Jun 2013 10:29:52 +0000 12 | Content-Type: multipart/mixed; boundary="----=ThisIsTheBoundaryStringaaa" 13 | 14 | 15 | ------=ThisIsTheBoundaryStringaaa 16 | Content-Type: text/plain; charset=US-ASCII 17 | 18 | Message could not be delivered to mobile. 19 | Error: No valid recipients for this MM 20 | 21 | 22 | Original Message: 23 | From: azumakuniyuki 24 | To: 0000000000@vzwpix.com 25 | Subject: test for bounce 26 | Date: Wed, 20 Jun 2013 10:29:52 +0000 27 | 28 | ------=ThisIsTheBoundaryStringaaa-- 29 | Content-Type: text/plain 30 | 31 | 32 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-13.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Delivered-To: nyaaaaan@nq.example.jp 3 | Received: (qmail 44453 invoked by alias); 24 Jun 2024 08:52:01 -0000 4 | Delivered-To: kijitora@nq.example.jp 5 | Received: (qmail 44450 invoked for bounce); 24 Jun 2024 08:52:01 -0000 6 | Date: 24 Jun 2024 08:52:01 -0000 7 | From: MAILER-DAEMON@nq.example.jp 8 | To: kijitora@nq.example.jp 9 | Subject: failure notice 10 | 11 | Hi. This is the qmail-send program at nq.example.jp. 12 | I'm afraid I wasn't able to deliver your message to the following addresses. 13 | This is a permanent error; I've given up. Sorry it didn't work out. 14 | 15 | : 16 | Sorry, I couldn't find any host named cx.libsisimai.com. (#5.1.2) 17 | 18 | --- Below this line is a copy of the message. 19 | 20 | Return-Path: 21 | Received: (qmail 44447 invoked by uid 0); 24 Jun 2024 08:52:01 -0000 22 | Date: 24 Jun 2024 08:52:01 -0000 23 | Message-ID: <20240624085201.44446.qmail@nq.example.jp> 24 | From: kijitora@nq.example.jp 25 | To: nekochan@cx.libsisimai.com 26 | Subject: Nyaan? 27 | 28 | Nyaaaaaan 29 | 30 | -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/lhost-mailmarshalsmtp-01.eml: -------------------------------------------------------------------------------- 1 | Received: from MailMarshal.Sender ([127.0.0.1]) by relay.xxxxxxxxx.com id ; Mon, 22 Dec 2014 16:21:07 +0000 Message-ID: From: postmaster@igfej.xxxxxxxxxxxx.com To: originalsender@example.com CC: Date: Mon, 22 Dec 2014 16:21:07 +0000 Subject: Undeliverable Mail: "IIdentificaゥンゥルo" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="--=30ecf893-1096-4eca-ba85-bc3fca72024d" ----=30ecf893-1096-4eca-ba85-bc3fca72024d Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Your message: From: originalsender@example.com Subject: IIdentificaゥンゥルo Could not be delivered because of 550 5.1.1 User unknown The following recipients were affected: dummyuser@blabla.xxxxxxxxxxxx.com Additional Information ====================== Original Sender: Sender-MTA: <10.11.12.13> Remote-MTA: <10.0.0.1> Reporting-MTA: MessageName: Last-Attempt-Date: <16:21:07 seg, 22 Dezembro 2014> ----=30ecf893-1096-4eca-ba85-bc3fca72024d-- -------------------------------------------------------------------------------- /test/public/lhost-v5sendmail.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module V5sendmail 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['4.0.947', '421', 'expired', false, false]], 6 | '02' => [['5.0.912', '550', 'hostunknown', true, true]], 7 | '03' => [['5.0.911', '550', 'userunknown', true, true]], 8 | '04' => [['5.0.912', '550', 'hostunknown', true, true], 9 | ['5.0.912', '550', 'hostunknown', true, true]], 10 | '05' => [['5.0.971', '550', 'blocked', false, false], 11 | ['5.0.912', '550', 'hostunknown', true, true], 12 | ['5.0.912', '550', 'hostunknown', true, true], 13 | ['5.0.911', '550', 'userunknown', true, true]], 14 | '06' => [['5.0.909', '550', 'norelaying', false, true]], 15 | '07' => [['5.0.971', '554', 'blocked', false, false], 16 | ['5.0.912', '550', 'hostunknown', true, true], 17 | ['5.0.911', '550', 'userunknown', true, true]], 18 | } 19 | end 20 | end 21 | 22 | -------------------------------------------------------------------------------- /test/public/lhost-office365.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Office365 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.10', '550', 'userunknown', true, true]], 6 | '02' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '03' => [['5.1.0', '550', 'authfailure', false, false]], 8 | '04' => [['5.1.351', '550', 'filtered', false, true]], 9 | '05' => [['5.1.8', '501', 'rejected', false, false]], 10 | '06' => [['5.4.312', '550', 'networkerror', false, false]], 11 | '07' => [['5.1.351', '550', 'userunknown', true, true]], 12 | '08' => [['5.4.316', '550', 'networkerror', false, false]], 13 | '09' => [['5.1.351', '550', 'userunknown', true, true]], 14 | '10' => [['5.1.351', '550', 'userunknown', true, true]], 15 | '11' => [['5.1.1', '550', 'userunknown', true, true]], 16 | '12' => [['5.2.2', '550', 'mailboxfull', false, true]], 17 | '13' => [['5.1.10', '550', 'userunknown', true, true]], 18 | } 19 | end 20 | end 21 | 22 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-exim-07.eml: -------------------------------------------------------------------------------- 1 | From MAILER-DAEMON Mon 1 Jan 2015 00:00:00 +0900 2 | Return-Path: <> 3 | X-Original-To: shironeko@example.ad.jp 4 | Delivered-To: shironeko@example.ad.jp 5 | Received: from shiba@example.com 6 | by xxxxxx (Postfix) with ESMTPS id xxxxxx 7 | for shironeko@example.ad.jp; Mon, 1 Jan 2015 00:00:00 +0900 (JST) 8 | Received: from Debian-exim by xxxxxx with local 9 | id xxxxxxx; Mon, 1 Jan 2015 00:00:00 +0900 10 | X-Failed-Recipients: shiba@example.com 11 | Reply-To: shiba@example.com 12 | Auto-Submitted: auto-replied 13 | From: Mail Delivery System 14 | To: shironeko@example.ad.jp 15 | Subject: Mail delivery failed: returning message to sender 16 | Date: Mon, 1 Jan 2015 00:00:00 +0900 17 | 18 | This message was created automatically by mail delivery software. 19 | 20 | A message that you sent could not be delivered to one or more of its 21 | recipients. This is a permanent error. The following address(es) failed: 22 | 23 | save to xxxx 24 | generated by xxxx 25 | mailbox is full: retry timeout exceeded 26 | 27 | ------ This is a copy of the message, including all the headers. ------ 28 | 29 | -------------------------------------------------------------------------------- /set-of-emails/maildir/tmp/lhost-exim-07.eml: -------------------------------------------------------------------------------- 1 | From MAILER-DAEMON Mon 1 Jan 2015 00:00:00 +0900 2 | Return-Path: <> 3 | X-Original-To: shironeko@example.ad.jp 4 | Delivered-To: shironeko@example.ad.jp 5 | Received: from shiba@example.com 6 | by xxxxxx (Postfix) with ESMTPS id xxxxxx 7 | for shironeko@example.ad.jp; Mon, 1 Jan 2015 00:00:00 +0900 (JST) 8 | Received: from Debian-exim by xxxxxx with local 9 | id xxxxxxx; Mon, 1 Jan 2015 00:00:00 +0900 10 | X-Failed-Recipients: shiba@example.com 11 | Reply-To: shiba@example.com 12 | Auto-Submitted: auto-replied 13 | From: Mail Delivery System 14 | To: shironeko@example.ad.jp 15 | Subject: Mail delivery failed: returning message to sender 16 | Date: Mon, 1 Jan 2015 00:00:00 +0900 17 | 18 | This message was created automatically by mail delivery software. 19 | 20 | A message that you sent could not be delivered to one or more of its 21 | recipients. This is a permanent error. The following address(es) failed: 22 | 23 | save to xxxx 24 | generated by xxxx 25 | mailbox is full: retry timeout exceeded 26 | 27 | ------ This is a copy of the message, including all the headers. ------ 28 | 29 | -------------------------------------------------------------------------------- /test/public/lhost-messagingserver.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module MessagingServer 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.2.0', '', 'mailboxfull', false, true]], 7 | '03' => [['5.7.1', '550', 'filtered', false, true], 8 | ['5.7.1', '550', 'filtered', false, true]], 9 | '04' => [['5.2.2', '550', 'mailboxfull', false, true]], 10 | '05' => [['5.4.4', '', 'hostunknown', true, true]], 11 | '06' => [['5.2.1', '550', 'filtered', false, true]], 12 | '07' => [['4.4.7', '', 'expired', false, false]], 13 | '08' => [['5.0.0', '550', 'filtered', false, true]], 14 | '09' => [['5.0.0', '550', 'userunknown', true, true]], 15 | '10' => [['5.1.10', '', 'notaccept', true, true]], 16 | '11' => [['5.1.8', '501', 'rejected', false, false]], 17 | '12' => [['4.2.2', '', 'mailboxfull', false, false]], 18 | } 19 | end 20 | end 21 | 22 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-26.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e071e 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Wed, 12 Jun 2024 08:46:42 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Wed, 12 Jun 2024 08:46:42 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mbox.example.org [192.0.2.25] did not like our RCPT TO: 17 | 550 5.1.1 : Recipient address rejected: User unknown 18 | 19 | Original message follows. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0003 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Wed, 12 Jun 2024 08:46:42 +0900 26 | Subject: Nyaan ? 27 | To: nekochan 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Wed, 12 Jun 2024 08:46:42 +0900 30 | Message-Id: <6668e1e2.e0003.9b9b713@df.example.jp> 31 | From: 32 | 33 | df.example.jp 34 | -------------------------------------------------------------------------------- /set-of-emails/maildir/dos/lhost-verizon-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Received: from njbrspamp1.vtext.com (njbrspamp1.vtext.com [192.0.2.146]) 3 | by nijo.example.jp (V8/cf) with ESMTP id r5KATqOU002339 4 | for ; Thu, 20 Jun 2013 06:29:53 -0400 5 | Received: from 39.example.com (HELO m01.vzwpix.com) ([192.0.2.39]) 6 | by njbrspamp1.vtext.com with SMTP; 20 Jun 2013 10:29:52 +0000 7 | From:MMSC NDR Administrator 8 | To:kijitora@example.jp 9 | Subject:Undeliverable Message 10 | Message-ID: <212238484192055707@-212238484192055708> 11 | Date: Wed, 20 Jun 2013 10:29:52 +0000 12 | Content-Type: multipart/mixed; boundary="----=ThisIsTheBoundaryStringaaa" 13 | 14 | 15 | ------=ThisIsTheBoundaryStringaaa 16 | Content-Type: text/plain; charset=US-ASCII 17 | 18 | Message could not be delivered to mobile. 19 | Error: No valid recipients for this MM 20 | 21 | 22 | Original Message: 23 | From: azumakuniyuki 24 | To: 0000000000@vzwpix.com 25 | Subject: test for bounce 26 | Date: Wed, 20 Jun 2013 10:29:52 +0000 27 | 28 | ------=ThisIsTheBoundaryStringaaa-- 29 | Content-Type: text/plain 30 | 31 | 32 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-x2-03.eml: -------------------------------------------------------------------------------- 1 | From MAILER-DAEMON Thu Apr 29 23:34:45 2009 2 | Return-path: <> 3 | Envelope-to: shironeko@example.co.jp 4 | Delivery-date: Thu, 12 Sep 2009 23:34:45 +0100 5 | Date: 12 Sep 2009 23:34:45 +0000 6 | From: MAILER-DAEMON@example.com 7 | To: shironeko@example.co.jp 8 | Subject: failed delivery 9 | 10 | Message from example.com. 11 | Unable to deliver message to the following address(es). 12 | 13 | : 14 | unable to connect to remote server [192.0.2.222:25]: Operation timed 15 | out 16 | I'm not going to try again; this message has been in the queue too long. 17 | 18 | --- Original message follows. 19 | 20 | Return-Path: 21 | X-Originating-IP: [192.0.2.222] 22 | Authentication-Results: mx4.example.com 23 | from=example.co.jp; domainkeys=neutral (no sig) 24 | From: Nyanko 25 | To: kijitora@example.org 26 | Subject: Nyaaaan 27 | Message-ID: <00000000000000000@example.co.jp> 28 | MIME-Version: 1.0 29 | Content-Type: text/plain; charset=utf-8 30 | Content-Transfer-Encoding: 7bit 31 | Sender: HassleMe 32 | Date: Thu, 11 Sep 2009 23:34:45 +0100 33 | 34 | Nyaaan 35 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-exchange2003-04.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Received: from mx8.example.com ([192.0.2.87]) 3 | by relay9.example.ne.jp (Post.Office MTA v3.1.2 release (PO203-101c) 4 | ID# 0-00000000000000000) with SMTP id 00000000for ; 5 | Thu, 29 Apr 2001 23:34:45 +0900 6 | Received: by mx8.example.com with SMTP 7 | (Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63) 8 | id <00000000.00000000@mx8.example.com>; Thu, 29 Apr 2001 23:34:45 +0900 9 | Message-ID: <00000000.00000000@mx8.example.com> 10 | From: System Administrator 11 | To: 12 | Subject: Undeliverable: Nyaan 13 | Date: Thu, 29 Apr 2001 23:34:45 +0900 14 | X-Mailer: Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63 15 | 16 | 17 | Your message did not reach some or all of the intended recipients. 18 | 19 | To: shironeko@example.jp 20 | Subject: Nyaan 21 | Sent: 4/29/01 11:34:45 PM 22 | 23 | The following recipient(s) could not be reached: 24 | 25 | kijitora@example.com on 4/29/01 11:34:45 PM 26 | Recipient Not Found 27 | MSEXCH:IMC:NEKO:KIJITORA:CAT 28 | 29 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-exchange2003-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Received: from gw.example.com ([192.0.2.23]) 3 | by gw2.ext.example.net (Post.Office MTA v0.0.0 4 | release (P0000-000x) ID# 0-00000000000000000) with ESMTP 5 | id 0000001 for ; 6 | Thu, 29 Apr 2010 00:00:00 -0000 7 | Received: by gw with Internet Mail Service (5.5.1960.3) 8 | id <00000000>; Thu, 29 Apr 2010 00:00:00 -0000 9 | Message-ID: <00000000000000000000000000000000000000@gw.example.com> 10 | From: System Administrator 11 | To: shironeko@example.com 12 | Subject: Undeliverable: Kijitora Cat 13 | Date: Thu, 29 Apr 2010 00:00:00 -0000 14 | X-MS-TNEF-Correlator: <00000000000000000000000000000000000000@example.com> 15 | X-Mailer: Internet Mail Service (5.5.1960.3) 16 | X-MS-Embedded-Report: 17 | 18 | Your message 19 | 20 | To: shironeko@example.com 21 | Subject: Kijitora Cat 22 | Sent: Thu, 29 Apr 2010 00:00:00 -0000 23 | 24 | did not reach the following recipient(s): 25 | 26 | kijitora@example.jp on Thu, 29 Apr 2010 00:00:00 -0000 27 | The recipient name is not recognized 28 | MSEXCH:IMS:NNN:KIJITORACAT:NEKO 0 (000C05A6) 29 | Unknown Recipient 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/private/lhost-einsundeins.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module EinsUndEins 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.922', '', 'mailboxfull', false, false]], 6 | '1002' => [['5.0.922', '', 'mailboxfull', false, false]], 7 | '1003' => [['5.0.934', '', 'mesgtoobig', false, false]], 8 | '1004' => [['5.1.1', '550', 'userunknown', true, true]], 9 | '1005' => [['5.4.1', '550', 'userunknown', true, true]], 10 | '1006' => [['5.4.1', '550', 'userunknown', true, true]], 11 | '1007' => [['5.4.1', '550', 'userunknown', true, true]], 12 | '1008' => [['5.4.1', '550', 'userunknown', true, true]], 13 | '1009' => [['5.1.1', '550', 'userunknown', true, true]], 14 | '1010' => [['5.1.1', '550', 'userunknown', true, true]], 15 | '1011' => [['5.4.1', '550', 'userunknown', true, true]], 16 | '1012' => [['5.4.1', '550', 'userunknown', true, true]], 17 | '1013' => [['5.4.1', '550', 'userunknown', true, true]], 18 | 19 | } 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-17.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e072a 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:47:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:47:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.0.0 : Recipient address rejected: On hold. See https://libsisimai.org/en/reason/#onhold 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0728 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:47:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:47:33 +0900 30 | Message-Id: <66681d35.e0728.180b873f@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-05.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0724 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:17:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:17:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.7.26 : Recipient address rejected: Multiple authentication checks failed 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0722 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:17:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:17:33 +0900 30 | Message-Id: <6668162d.e0722.3a6a6f36@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /test/public/lhost-yahoo.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Yahoo 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.2.2', '550', 'mailboxfull', false, true]], 7 | '03' => [['5.1.1', '550', 'userunknown', true, true]], 8 | '04' => [['5.2.2', '550', 'mailboxfull', false, true]], 9 | '05' => [['5.2.1', '550', 'userunknown', true, true]], 10 | '06' => [['5.0.910', '550', 'filtered', false, true]], 11 | '07' => [['5.0.911', '550', 'userunknown', true, true]], 12 | '08' => [['5.2.2', '550', 'mailboxfull', false, true]], 13 | '09' => [['5.0.932', '', 'notaccept', true, true]], 14 | '10' => [['5.1.1', '550', 'userunknown', true, true]], 15 | '11' => [['5.1.8', '501', 'rejected', false, false]], 16 | '12' => [['5.1.8', '501', 'rejected', false, false]], 17 | '13' => [['5.0.930', '', 'systemerror', false, false]], 18 | '14' => [['5.0.971', '554', 'blocked', false, false]], 19 | } 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-09.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0728 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:29:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:29:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.2.1 : Recipient address rejected: User unknown. See https://libsisimai.org/en/reason/#filtered 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0726 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:29:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:29:33 +0900 30 | Message-Id: <666818fd.e0726.7e456d07@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/lhost-domino-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: Received: from mta52.example.jp (mta52.example.jp [192.0.2.89]) by mx.example.com (8.14.1/8.12.11) with ESMTP id o000000000 for ; Tue, 29 Apr 2010 10:45:04 -0700 Received: from mta52.example.jp (MTAXYZ [127.0.0.1]) by mx0.example.jp (localhost) with ESMTP id 0000000000 for ; Tue, 29 Apr 2010 12:34:45 +0900 (JST) Received: from x.mail.example.jp (x.mail.example.jp [192.0.2.25]) by mta52.example.jp (localhost) with ESMTP id 8888888888 for ; Tue, 29 Apr 2010 12:34:45 +0900 (JST) Date: Tue, 29 Apr 2010 10:54:01 -0700 MIME-Version: 1.0 From: Postmaster@example.jp To: Sender Address Subject: DELIVERY FAILURE: User Kijitoranyan (kijitora@example.jp) not listed in Domino Directory X-OriginalArrivalTime: 29 Apr 2010 19:02:59.0038 (UTC) FILETIME=[00000000:00000000] Message-ID: <0000000000.000000000-000000000.00000000-00000000.00000000@example.com> Content-Type: Text/Plain Content-Transfer-Encoding: 8bit Your message Subject: Test Bounce was not delivered to: kijitora@example.jp because: User some.name (kijitora@example.jp) not listed in Domino Directory -------------------------------------------------------------------------------- /test/public/rhost-gsuite.rb: -------------------------------------------------------------------------------- 1 | module RhostEngineTest::Public 2 | module GSuite 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | "01" => [["5.1.0", "550", "userunknown", true, true]], 6 | "02" => [["5.0.0", "", "userunknown", true, true]], 7 | "03" => [["4.0.0", "", "notaccept", false, false]], 8 | "04" => [["4.0.0", "", "networkerror", false, false]], 9 | "05" => [["4.0.0", "", "networkerror", false, false]], 10 | "06" => [["4.4.1", "", "expired", false, false]], 11 | "07" => [["4.4.1", "", "expired", false, false]], 12 | "08" => [["5.0.0", "550", "filtered", false, true]], 13 | "09" => [["5.0.0", "550", "userunknown", true, true]], 14 | "10" => [["4.0.0", "", "notaccept", false, false]], 15 | "11" => [["5.1.8", "501", "rejected", false, false]], 16 | "12" => [["5.0.0", "", "spamdetected", false, false]], 17 | "13" => [["4.0.0", "", "networkerror", false, false]], 18 | "14" => [["5.1.1", "550", "userunknown", true, true]], 19 | } 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-15.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e072a 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:43:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:43:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.7.0 : Recipient address rejected: No relaying. See https://libsisimai.org/en/reason/#norelaying 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0728 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:43:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:43:33 +0900 30 | Message-Id: <66681c45.e0728.e963bd9@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /sisimai.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'sisimai/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = 'sisimai' 8 | spec.version = Sisimai::VERSION 9 | spec.authors = ['azumakuniyuki'] 10 | spec.email = ['azumakuniyuki+rubygems.org@gmail.com'] 11 | 12 | spec.summary = 'Mail Analyzing Interface' 13 | spec.description = 'Sisimai is a Ruby library for analyzing RFC5322 bounce emails and generating structured data from parsed results.' 14 | spec.homepage = 'https://libsisimai.org/' 15 | spec.license = 'BSD-2-Clause' 16 | 17 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 18 | spec.bindir = 'exe' 19 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 20 | spec.require_paths = ['lib'] 21 | 22 | spec.required_ruby_version = '>= 2.5.0' 23 | 24 | spec.add_development_dependency 'bundler', '>= 1.8' 25 | spec.add_development_dependency 'rake', '>= 10.0' 26 | spec.add_development_dependency 'minitest', '>= 5.0' 27 | spec.add_runtime_dependency 'oj', '>= 3.0.0' 28 | end 29 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-06.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0726 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:21:33 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:21:33 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.7.25 : Recipient address rejected: Reverse DNS validation failed: See https://libsisimai.org/en/reason/#blocked 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0724 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:21:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:21:33 +0900 30 | Message-Id: <6668171d.e0724.4a78d49a@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-21.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e072e 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:59:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:59:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 525 5.7.13 : Recipient address rejected: User account disabled. See https://libsisimai.org/en/reason/#suspend 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e072c 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:59:34 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:59:34 +0900 30 | Message-Id: <66682006.e072c.184b1dc1@df.example.jp> 31 | From: 32 | 33 | 34 | -------------------------------------------------------------------------------- /set-of-emails/maildir/dos/lhost-exchange-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Received: from gw.example.com ([192.0.2.23]) 3 | by gw2.ext.example.net (Post.Office MTA v0.0.0 4 | release (P0000-000x) ID# 0-00000000000000000) with ESMTP 5 | id 0000001 for ; 6 | Thu, 29 Apr 2010 00:00:00 -0000 7 | Received: by gw with Internet Mail Service (5.5.1960.3) 8 | id <00000000>; Thu, 29 Apr 2010 00:00:00 -0000 9 | Message-ID: <00000000000000000000000000000000000000@gw.example.com> 10 | From: System Administrator 11 | To: shironeko@example.com 12 | Subject: Undeliverable: Kijitora Cat 13 | Date: Thu, 29 Apr 2010 00:00:00 -0000 14 | X-MS-TNEF-Correlator: <00000000000000000000000000000000000000@example.com> 15 | X-Mailer: Internet Mail Service (5.5.1960.3) 16 | X-MS-Embedded-Report: 17 | 18 | Your message 19 | 20 | To: shironeko@example.com 21 | Subject: Kijitora Cat 22 | Sent: Thu, 29 Apr 2010 00:00:00 -0000 23 | 24 | did not reach the following recipient(s): 25 | 26 | kijitora@example.jp on Thu, 29 Apr 2010 00:00:00 -0000 27 | The recipient name is not recognized 28 | MSEXCH:IMS:NNN:KIJITORACAT:NEKO 0 (000C05A6) 29 | Unknown Recipient 30 | 31 | 32 | -------------------------------------------------------------------------------- /set-of-emails/maildir/dos/lhost-exchange2003-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Received: from gw.example.com ([192.0.2.23]) 3 | by gw2.ext.example.net (Post.Office MTA v0.0.0 4 | release (P0000-000x) ID# 0-00000000000000000) with ESMTP 5 | id 0000001 for ; 6 | Thu, 29 Apr 2010 00:00:00 -0000 7 | Received: by gw with Internet Mail Service (5.5.1960.3) 8 | id <00000000>; Thu, 29 Apr 2010 00:00:00 -0000 9 | Message-ID: <00000000000000000000000000000000000000@gw.example.com> 10 | From: System Administrator 11 | To: shironeko@example.com 12 | Subject: Undeliverable: Kijitora Cat 13 | Date: Thu, 29 Apr 2010 00:00:00 -0000 14 | X-MS-TNEF-Correlator: <00000000000000000000000000000000000000@example.com> 15 | X-Mailer: Internet Mail Service (5.5.1960.3) 16 | X-MS-Embedded-Report: 17 | 18 | Your message 19 | 20 | To: shironeko@example.com 21 | Subject: Kijitora Cat 22 | Sent: Thu, 29 Apr 2010 00:00:00 -0000 23 | 24 | did not reach the following recipient(s): 25 | 26 | kijitora@example.jp on Thu, 29 Apr 2010 00:00:00 -0000 27 | The recipient name is not recognized 28 | MSEXCH:IMS:NNN:KIJITORACAT:NEKO 0 (000C05A6) 29 | Unknown Recipient 30 | 31 | 32 | -------------------------------------------------------------------------------- /test/public/lhost-googlegroups.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module GoogleGroups 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.0.918', '', 'rejected', false, false]], 6 | '02' => [['5.0.918', '', 'rejected', false, false]], 7 | '03' => [['5.0.918', '', 'rejected', false, false]], 8 | '04' => [['5.0.918', '', 'rejected', false, false]], 9 | '05' => [['5.0.918', '', 'rejected', false, false]], 10 | '06' => [['5.0.918', '', 'rejected', false, false]], 11 | '07' => [['5.0.918', '', 'rejected', false, false]], 12 | '08' => [['5.0.918', '', 'rejected', false, false]], 13 | '09' => [['5.0.918', '', 'rejected', false, false]], 14 | '10' => [['5.0.918', '', 'rejected', false, false]], 15 | '11' => [['5.0.918', '', 'rejected', false, false]], 16 | '12' => [['5.0.918', '', 'rejected', false, false]], 17 | '13' => [['5.0.918', '', 'rejected', false, false]], 18 | '14' => [['5.0.918', '', 'rejected', false, false]], 19 | } 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /.github/workflows/codecovio.yml: -------------------------------------------------------------------------------- 1 | name: Upload coverage reports to Codecov 2 | on: 3 | push: 4 | branches: ["5-stable"] 5 | pull_request: 6 | branches: ["*"] 7 | jobs: 8 | codecov: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout the repository(CRuby) 12 | uses: actions/checkout@v4 13 | with: 14 | ref: ${{ github.event.pull_request.head.ref }} 15 | - name: Setup CRuby 16 | uses: ruby/setup-ruby@v1 17 | with: 18 | ruby-version: "3.4.7" 19 | - name: Install minitest 20 | run: gem install minitest -v 5.15.0 21 | - name: Install oj 22 | run: gem install oj -v 3.10.0 23 | - name: Install bundle, rake, simplecov, and simplecov-cobertura 24 | run: gem install bundle rake simplecov simplecov-cobertura 25 | - name: Check the CRuby version 26 | run: ruby -v 27 | - name: Execute public tests with the coverage report 28 | run: ruby -I./lib ./test/coverage.rb 29 | - name: Run Codecov on GitHub Actions 30 | uses: codecov/codecov-action@v4.4.0 31 | with: 32 | token: ${{ secrets.CODECOV_TOKEN }} 33 | files: ./coverage/coverage.xml 34 | verbose: true 35 | 36 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-03.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0720 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:09:35 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:09:35 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mta5.am0.yahoodns.net [67.195.204.79] did not like our final DATA: 17 | 554 5.7.9 Message not accepted for policy reasons. See https://senders.yahooinc.com/error-codes 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e06d1 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:09:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:09:33 +0900 30 | Message-Id: <6668144d.e06d1.1bdca37a@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-12.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0728 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:35:33 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:35:33 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 552 5.2.2 : Recipient address rejected: Mailbox full. See https://libsisimai.org/en/reason/#mailboxfull 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0726 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:35:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:35:33 +0900 30 | Message-Id: <66681a65.e0726.29ed079c@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-13.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0728 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:37:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:37:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 554 5.3.0 : Recipient address rejected: Mailer error. See https://libsisimai.org/en/reason/#mailererror 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0726 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:37:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:37:33 +0900 30 | Message-Id: <66681add.e0726.72bc0b4c@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-24.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0734 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 19:11:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 19:11:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.1.1 : Recipient address rejected: User unknown. See https://libsisimai.org/en/reason/#userunknown 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0732 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 19:11:34 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 19:11:34 +0900 30 | Message-Id: <666822d6.e0732.f6410e7@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/lhost-opensmtpd-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> Received: from vagrant-centos65.example.com (c213502.kyoto.example.ne.jp [192.0.2.135]) by aneyakoji.example.jp (V8/cf) with ESMTP id s6HB0VsJ028505 for ; Thu, 17 Jul 2014 20:00:32 +0900 Message-Id: <201407171100.s6HB0VsJ028505@aneyakoji.example.jp> Received: from localhost (localhost [local]); by localhost (OpenSMTPD) with ESMTPA id 1e2a9eaa; for ; Thu, 17 Jul 2014 11:20:14 +0000 (UTC) Subject: Delivery status notification: error From: Mailer Daemon To: kijitora@example.jp Date: Thu, 17 Jul 2014 11:20:14 +0000 (UTC) Hi! This is the MAILER-DAEMON, please DO NOT REPLY to this e-mail. An error has occurred while attempting to deliver a message for the following list of recipients: apdugoaidugoaidugoaeiudggadi@gmail.com: 550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 ad1si1997204pbd.83 - gsmtp Below is a copy of the original message: Received: from [127.0.0.1] (localhost [127.0.0.1]); by localhost (OpenSMTPD) with ESMTP id d70f9624; for ; Thu, 17 Jul 2014 11:19:54 +0000 (UTC) Subject: test from OpenSMTPD From: kijitora@example.jp test -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-07.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0726 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:23:33 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:23:33 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.6.0 : Recipient address rejected: Media error. See https://libsisimai.org/en/reason/#contenterror 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0724 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:23:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:23:33 +0900 30 | Message-Id: <66681795.e0724.764d9012@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-20.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e072c 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:55:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:55:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.7.0 : Recipient address rejected: Spam detected. See https://libsisimai.org/en/reason/#spamdetected 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e072a 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:55:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:55:33 +0900 30 | Message-Id: <66681f15.e072a.19d854c3@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-x1-03.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | X-Original-To: sys@errors.example.co.jp 3 | Delivered-To: sys@errors.example.co.jp 4 | Received: from relay1.example.co.jp (unknown [192.0.2.25]) 5 | by fix1.example.co.jp (Postfix) with ESMTPS id mkpxxD10tyzKg6Zp 6 | for ; Mon, 6 Jan 2025 22:22:37 +0900 (JST) 7 | Received: from mailhub.example.jp (ip-192-0-2-50.ap-northeast-1.compute.internal [192.0.2.50]) 8 | by relay1.example.co.jp (Postfix) with ESMTPS id 3KkXpk75Q0zMwVmP 9 | for ; Mon, 6 Jan 2025 22:22:29 +0900 (JST) 10 | Received: from localhost by mailhub.example.jp; 11 | 06 Jan 2025 22:22:29 +0900 12 | Message-Id: <000000000512@mailhub.example.co.jp> 13 | Date: 06 Jan 2025 22:22:29 +0900 14 | To: nekochan@example.co.jp 15 | From: "Mail Delivery System" 16 | Content-Type: text/plain;charset=iso-2022-jp 17 | Content-Transfer-Encoding: quoted-printable 18 | Subject: Mail Delivery Failure 19 | 20 | The original message was received at 06 Jan 2025 22:22:29 +0900 21 | from nekochan@example.co.jp 22 | 23 | ---The following addresses had delivery errors--- 24 | 25 | kijitora@example.org [User unknown] 26 | 27 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-14.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0728 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:39:33 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:39:33 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 554 5.3.4 : Recipient address rejected: Message too big for system. See https://libsisimai.org/en/reason/#mesgtoobig 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0726 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:39:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:39:33 +0900 30 | Message-Id: <66681b55.e0726.3201b1e4@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-23.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e072e 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 19:03:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 19:03:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 554 5.3.0 : Recipient address rejected: Internal system error. See https://libsisimai.org/en/reason/#systemerror 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e072c 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 19:03:34 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 19:03:34 +0900 30 | Message-Id: <666820f6.e072c.44bd3f67@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-11.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0728 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:33:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:33:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.1.2 : Recipient address rejected: Bad destination system address. See https://libsisimai.org/en/reason/#hostunknown 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0726 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:33:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:33:33 +0900 30 | Message-Id: <666819ed.e0726.115fa400@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-16.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e072a 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:45:33 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:45:33 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 521 5.3.2 : Recipient address rejected: System not accepting network messages. See https://libsisimai.org/en/reason/#notaccept 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0728 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:45:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:45:33 +0900 30 | Message-Id: <66681cbd.e0728.29f828c0@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-v5sendmail-06.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from mx1.example.net ([192.0.2.120]) 3 | by mx9.example.net (Post.Office MTA v3.1.2 release (FF000+0900) 4 | ID# 0+09000000000000000) with SMTP id 0000000 for ; 5 | Thu, 29 Apr 1999 23:34:45 +0900 6 | Received: by mx1.example.net; (5.65/1.37) id 0000000; Thu, 29 Apr 1999 23:34:45 +0900 7 | Date: Thu, 29 Apr 1999 23:34:45 +0900 8 | From: Mail Delivery Subsystem 9 | Subject: Returned mail: Deferred: Connection timed out during user open with example.org 10 | Message-Id: <0000000000.0000000@mx1.example.net> 11 | To: shironeko@example.jp 12 | 13 | ----- Transcript of session follows ----- 14 | While talking to mx.example.edu: 15 | >>> MAIL From: 16 | <<< 550 Insecure Mail Relay 17 | 554 ... Remote protocol error 18 | 421 example.org (smtp)... Deferred: Connection timed out during user open with example.org 19 | 20 | ----- Unsent message follows ----- 21 | Received: by mx1.example.net; (5.65/1.37) id 0000000; 22 | Thu, 29 Apr 1999 23:34:45 +0900 23 | From: shironeko@example.jp 24 | To: kijitora@example.edu 25 | Subject: Nyaaaaan 26 | 27 | Nyaaaan 28 | 29 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-19.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e072c 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:53:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:53:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 551 5.7.1 : Recipient address rejected: Delivery not authorized. See https://libsisimai.org/en/reason/#securityerror 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e072a 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:53:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:53:33 +0900 30 | Message-Id: <66681e9d.e072a.9c343d6@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-10.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0728 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:31:33 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:31:33 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.1.6 : Recipient address rejected: Destination mailbox has moved, No forwarding address. See https://libsisimai.org/en/reason/#hasmoved 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0726 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:31:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:31:33 +0900 30 | Message-Id: <66681975.e0726.7dcedb39@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-18.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e072a 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:49:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:49:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 550 5.7.0 : Recipient address rejected: Policy violation. See https://libsisimai.org/en/reason/#policyviolation 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0728 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:49:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:49:33 +0900 30 | Message-Id: <66681dad.e0728.6b657381@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-22.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e072e 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 19:01:34 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 19:01:34 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 501 5.1.3 : Recipient address rejected: Bad destination mailbox address syntax. See https://libsisimai.org/en/reason/#syntaxerror 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e072c 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 19:01:34 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 19:01:34 +0900 30 | Message-Id: <6668207e.e072c.4296cb8d@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /test/private/rfc3834.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module RFC3834 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['', '', 'vacation', false, false]], 6 | '1002' => [['', '', 'vacation', false, false]], 7 | '1003' => [['', '', 'vacation', false, false]], 8 | '1004' => [['', '', 'vacation', false, false]], 9 | '1005' => [['', '', 'vacation', false, false]], 10 | '1006' => [['', '', 'vacation', false, false]], 11 | '1007' => [['', '', 'vacation', false, false]], 12 | '1008' => [['', '', 'vacation', false, false]], 13 | '1009' => [['', '', 'vacation', false, false]], 14 | '1010' => [['', '', 'vacation', false, false]], 15 | '1011' => [['', '', 'vacation', false, false]], 16 | '1012' => [['', '', 'vacation', false, false]], 17 | '1013' => [['', '', 'vacation', false, false]], 18 | '1014' => [['5.0.921', '', 'suspend', false, true]], 19 | } 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-08.eml: -------------------------------------------------------------------------------- 1 | Received: from MAILER-DAEMON 2 | id e0726 3 | by df.example.jp (DragonFly Mail Agent v0.13); 4 | Tue, 11 Jun 2024 18:25:33 +0900 5 | X-Original-To: 6 | From: MAILER-DAEMON <> 7 | To: kijitora@df.example.jp 8 | Subject: Mail delivery failed 9 | Message-Id: 10 | Date: Tue, 11 Jun 2024 18:25:33 +0900 11 | 12 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 13 | 14 | There was an error delivering your mail to . 15 | 16 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 17 | 552 5.2.3 : Recipient address rejected: Message length exceeds administrative limit. See https://libsisimai.org/en/reason/#exceedlimit 18 | 19 | Message headers follow. 20 | 21 | Received: from root (uid 0) 22 | (envelope-from kijitora@df.example.jp) 23 | id e0724 24 | by df.example.jp (DragonFly Mail Agent v0.13); 25 | Tue, 11 Jun 2024 18:25:33 +0900 26 | Subject: Nyaan 01 27 | To: 28 | User-Agent: mail (GNU Mailutils 3.14) 29 | Date: Tue, 11 Jun 2024 18:25:33 +0900 30 | Message-Id: <6668180d.e0724.7c2abac3@df.example.jp> 31 | From: 32 | 33 | -------------------------------------------------------------------------------- /test/private/lhost-mfilter.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module MFILTER 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.910', '550', 'filtered', false, true]], 6 | '1002' => [['5.1.1', '550', 'userunknown', true, true]], 7 | '1003' => [['5.0.910', '550', 'filtered', false, true]], 8 | '1004' => [['5.0.910', '550', 'filtered', false, true]], 9 | '1005' => [['5.1.1', '550', 'userunknown', true, true]], 10 | '1006' => [['5.0.910', '550', 'filtered', false, true]], 11 | '1007' => [['5.0.911', '550', 'userunknown', true, true]], 12 | '1008' => [['5.4.1', '550', 'rejected', false, false]], 13 | '1009' => [['5.4.1', '550', 'rejected', false, false]], 14 | '1010' => [['4.3.1', '452', 'systemfull', false, false]], 15 | '1011' => [['5.6.0', '550', 'spamdetected', false, false]], 16 | '1012' => [['5.1.1', '550', 'userunknown', true, true]], 17 | '1013' => [['5.0.910', '550', 'filtered', false, true]], 18 | '1014' => [['5.1.1', '550', 'userunknown', true, true]], 19 | } 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /test/private/lhost-outlook.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Outlook 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1002' => [['5.5.0', '550', 'userunknown', true, true]], 6 | '1003' => [['5.5.0', '550', 'userunknown', true, true]], 7 | '1007' => [['5.5.0', '550', 'requireptr', false, false]], 8 | '1008' => [['5.2.2', '552', 'mailboxfull', false, true]], 9 | '1016' => [['5.2.2', '550', 'mailboxfull', false, true]], 10 | '1017' => [['5.1.1', '550', 'userunknown', true, true]], 11 | '1018' => [['5.5.0', '554', 'hostunknown', true, true]], 12 | '1019' => [['5.1.1', '550', 'userunknown', true, true], 13 | ['5.2.2', '550', 'mailboxfull', false, true]], 14 | '1023' => [['5.1.1', '550', 'userunknown', true, true]], 15 | '1024' => [['5.1.1', '550', 'userunknown', true, true]], 16 | '1025' => [['5.5.0', '550', 'userunknown', true, true]], 17 | '1026' => [['5.5.0', '550', 'userunknown', true, true]], 18 | '1027' => [['5.5.0', '550', 'userunknown', true, true]], 19 | } 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-v5sendmail-03.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from mx5.example.com ([192.0.2.155]) 3 | by mx5.r.example.com (Post.Office MTA v3.1.2 4 | release (FF000-0000) ID# 0-00000000000000000) with SMTP 5 | id 0000000 for ; 6 | Thu, 28 Sep 1998 23:34:45 -0700 7 | Received: by mx5.example.com; (5.65/1.37) id 0000000; 8 | Thu, 29 Sep 1995 23:34:45 +0900 9 | Date: Thu, 29 Sep 1995 23:34:45 +0900 10 | From: Mail Delivery Subsystem 11 | Subject: Returned mail: Deferred: Connection timed out during user open with example.org 12 | Message-Id: <0000000000.0000000@mx5.example.com> 13 | To: webmaster@exampe.com 14 | 15 | ----- Transcript of session follows ----- 16 | While talking to smtp.example.com: 17 | >>> RCPT To: 18 | <<< 550 , User Unknown 19 | 550 ... User unknown 20 | 421 example.org (smtp)... Deferred: Connection timed out during user open with example.org 21 | 22 | ----- Unsent message follows ----- 23 | Received: by mx5.example.com; (5.65/1.37) id 0000000; 24 | Thu, 29 Apr 1995 23:34:45 +0900 25 | From: webmaster@exampe.com 26 | To: kijitora@exampe.org 27 | Subject: Nyaaan 28 | 29 | Nyaan 30 | -------------------------------------------------------------------------------- /lib/sisimai/rhost/cloudflare.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | module Rhost 3 | # Sisimai::Rhost detects the bounce reason from the content of Sisimai::Fact object as an argument 4 | # of find() method when the value of "rhost" of the object is "*.mx.cloudflare.net". 5 | # This class is called only from Sisimai::Fact class. 6 | module Cloudflare 7 | class << self 8 | MessagesOf = { 9 | "blocked" => ["found on one or more DNSBLs"], 10 | "systemerror" => ["Upstream error"], 11 | }.freeze 12 | 13 | # Detect bounce reason from Cloudflare Email Routing 14 | # @param [Sisimai::Fact] argvs Decoded email object 15 | # @return [String] The bounce reason for Cloudflare 16 | # @since v5.2.1 17 | # @see https://developers.cloudflare.com/email-routing/postmaster/ 18 | def find(argvs) 19 | return "" if argvs["diagnosticcode"].empty? 20 | MessagesOf.each_key do |e| 21 | # Try to match the error message with message patterns defined in $MessagesOf 22 | return e if MessagesOf[e].any? { |a| argvs["diagnosticcode"].include?(a) } 23 | end 24 | return "" 25 | end 26 | 27 | end 28 | end 29 | end 30 | end 31 | 32 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-05.eml: -------------------------------------------------------------------------------- 1 | Received: (qmail 1111 invoked for bounce); 29 Apr 2010 00:00:00 -0000 2 | Date: 29 Apr 2010 00:00:00 -0000 3 | From: MAILER-DAEMON@nijo.example.jp 4 | To: root@nijo.example.jp 5 | Subject: failure notice 6 | 7 | Hi. This is the qmail-send program at mx.example.jp. 8 | I'm afraid I wasn't able to deliver your message to the following addresses. 9 | This is a permanent error; I've given up. Sorry it didn't work out. 10 | 11 | : 12 | Unable to contact LDAP server. (#4.4.3)I'm not going to try again; this 13 | message has been in the queue too long. 14 | 15 | --- Below this line is a copy of the message. 16 | 17 | Return-Path: 18 | Received: (qmail 0000 invoked from network); 29 Apr 2010 23:45:43 -0000 19 | Received: from unknown (HELO example.jp) (192.0.2.24) 20 | by mx.example.jp with SMTP; 29 Apr 2010 23:45:43 -0000 21 | Message-ID: <00000000.000000000@example.jp> 22 | Date: Thu, 29 Apr 2010 23:45:40 +0900 23 | From: Shironeko 24 | MIME-Version: 1.0 25 | To: "Kijitora Cat" 26 | Subject: Nyaaaaaaaaaaaaaaaaaaaaaaaaaaan 27 | Content-Type: text/plain; charset=us-ascii; format=flowed 28 | Content-Transfer-Encoding: 7bit 29 | 30 | Nyaa 31 | 32 | -------------------------------------------------------------------------------- /sisimai-java.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'sisimai/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = 'sisimai' 8 | spec.version = Sisimai::VERSION 9 | spec.authors = ['azumakuniyuki'] 10 | spec.email = ['azumakuniyuki+rubygems.org@gmail.com'] 11 | 12 | spec.summary = 'Mail Analyzing Interface' 13 | spec.description = 'Sisimai is a Ruby library for analyzing RFC5322 bounce emails and generating structured data from parsed results.' 14 | spec.homepage = 'https://libsisimai.org/' 15 | spec.license = 'BSD-2-Clause' 16 | spec.platform = "java" 17 | 18 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 19 | spec.bindir = 'exe' 20 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 21 | spec.require_paths = ['lib'] 22 | 23 | spec.required_ruby_version = '>= 2.5.0' 24 | 25 | spec.add_development_dependency 'bundler', '>= 1.8' 26 | spec.add_development_dependency 'rake', '>= 10.0' 27 | spec.add_development_dependency 'minitest', '>= 5.0' 28 | spec.add_runtime_dependency 'jrjackson','~> 0.3', '>= 0.3.8' 29 | end 30 | -------------------------------------------------------------------------------- /test/private/lhost-googlegroups.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module GoogleGroups 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.0.918', '', 'rejected', false, false]], 6 | '1002' => [['5.0.918', '', 'rejected', false, false]], 7 | '1003' => [['5.0.918', '', 'rejected', false, false]], 8 | '1004' => [['5.0.918', '', 'rejected', false, false]], 9 | '1005' => [['5.0.918', '', 'rejected', false, false]], 10 | '1006' => [['5.0.918', '', 'rejected', false, false]], 11 | '1007' => [['5.0.918', '', 'rejected', false, false]], 12 | '1008' => [['5.0.918', '', 'rejected', false, false]], 13 | '1009' => [['5.0.918', '', 'rejected', false, false]], 14 | '1010' => [['5.0.918', '', 'rejected', false, false]], 15 | '1011' => [['5.0.918', '', 'rejected', false, false]], 16 | '1012' => [['5.0.918', '', 'rejected', false, false]], 17 | '1013' => [['5.0.918', '', 'rejected', false, false]], 18 | '1014' => [['5.0.918', '', 'rejected', false, false]], 19 | } 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-mailmarshal-02.eml: -------------------------------------------------------------------------------- 1 | Received: from MailMarshal.Sender ([127.0.0.1]) by rr1.example.com 2 | id ; Thu, 29 Apr 2015 23:34:45 +0000 3 | Message-ID: 4 | From: postmaster@neko.example.com 5 | To: sironeko@example.com 6 | CC: 7 | Date: Thu, 29 Apr 2015 23:34:45 +0000 8 | Subject: Undeliverable Mail: "Nyaan" 9 | MIME-Version: 1.0 10 | Content-Type: multipart/mixed; 11 | boundary="--=00ffff00-0000-0000-0000-eefe00002022" 12 | 13 | 14 | ----=00ffff00-0000-0000-0000-eefe00002022 15 | Content-Type: text/plain; 16 | charset="iso-8859-1" 17 | Content-Transfer-Encoding: 7bit 18 | 19 | Your message: 20 | From: sironeko@example.com 21 | Subject: Nyaan 22 | 23 | Could not be delivered because of 24 | 25 | 550 5.1.1 User unknown 26 | 27 | The following recipients were affected: 28 | kijitora@nyaan.example.com 29 | 30 | 31 | 32 | 33 | Additional Information 34 | ====================== 35 | Original Sender: 36 | Sender-MTA: <192.0.2.250> 37 | Remote-MTA: <203.0.113.2> 38 | Reporting-MTA: 39 | MessageName: 40 | Last-Attempt-Date: <23:34:45 qui, 29 Abril 2015> 41 | 42 | ----=00ffff00-0000-0000-0000-eefe00002022-- 43 | 44 | -------------------------------------------------------------------------------- /set-of-emails/maildir/mac/lhost-einsundeins-01.eml: -------------------------------------------------------------------------------- 1 | From: "Mail Delivery System" To: user1@xxxxxxxxxxxxxxxxxxx.pt Date: Tue, 23 Dec 2014 21:39:30 +0100 Subject: Mail delivery failed: returning message to sender MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-UI-Out-Filterresults: unknown:0; This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address failed: general@example.eu For the following reason: Mail size limit exceeded. For explanation visit http://postmaster.1and1.com/en/error-messages?ip=%1s --- The header of the original message is following. --- Received: (qmail 22456 invoked from network); 23 Dec 2014 20:39:27 -0000 Received: from unknown (HELO php09) (10.11.12.13) by relay.local with SMTP; 23 Dec 2014 20:39:27 -0000 Date: Tue, 23 Dec 2014 20:39:24 +0000 Message-ID: <2014122.Horde.aVib3NKNmpMSMBPv_KPp-w9@mail.xxxxxxxxxxxxxxxxxxx.pt> From: user1@xxxxxxxxxxxxxxxxxxx.pt To: Joaquim Subject: BOAS FESTAS! In-Reply-To: Content-Type: multipart/alternative; boundary="=_Bj5UaGbJV86-J0NyTypbMg8" MIME-Version: 1.0 -------------------------------------------------------------------------------- /test/public/lhost-gmail.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module Gmail 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '03' => [['5.7.0', '554', 'filtered', false, true]], 7 | '04' => [['5.7.1', '554', 'blocked', false, false]], 8 | '05' => [['5.7.1', '550', 'securityerror', false, false]], 9 | '06' => [['4.2.2', '450', 'mailboxfull', false, false]], 10 | '07' => [['5.0.976', '500', 'failedstarttls', false, false]], 11 | '08' => [['5.0.947', '', 'expired', false, false]], 12 | '09' => [['4.0.947', '', 'expired', false, false]], 13 | '10' => [['5.0.947', '', 'expired', false, false]], 14 | '11' => [['5.0.947', '', 'expired', false, false]], 15 | '15' => [['5.0.947', '', 'expired', false, false]], 16 | '16' => [['5.2.2', '550', 'mailboxfull', false, true]], 17 | '17' => [['4.0.947', '', 'expired', false, false]], 18 | '18' => [['5.1.1', '550', 'userunknown', true, true]], 19 | '19' => [['5.0.922', '', 'mailboxfull', false, false]], 20 | } 21 | end 22 | end 23 | 24 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-dragonfly-25.eml: -------------------------------------------------------------------------------- 1 | From MAILER-DAEMON Tue Jun 11 19:13:34 2024 2 | Received: from MAILER-DAEMON 3 | id e0734 4 | by df.example.jp (DragonFly Mail Agent v0.13); 5 | Tue, 11 Jun 2024 19:13:34 +0900 6 | X-Original-To: 7 | From: MAILER-DAEMON <> 8 | To: kijitora@df.example.jp 9 | Subject: Mail delivery failed 10 | Message-Id: 11 | Date: Tue, 11 Jun 2024 19:13:34 +0900 12 | 13 | This is the DragonFly Mail Agent v0.13 at df.example.jp. 14 | 15 | There was an error delivering your mail to . 16 | 17 | mail-inbound.libsisimai.net [192.0.2.25] did not like our RCPT TO: 18 | 550 5.7.0 : Recipient address rejected: Virus detected. See https://libsisimai.org/en/reason/#virusdetected 19 | 20 | Message headers follow. 21 | 22 | Received: from root (uid 0) 23 | (envelope-from kijitora@df.example.jp) 24 | id e0732 25 | by df.example.jp (DragonFly Mail Agent v0.13); 26 | Tue, 11 Jun 2024 19:13:34 +0900 27 | Subject: Nyaan 01 28 | To: 29 | User-Agent: mail (GNU Mailutils 3.14) 30 | Date: Tue, 11 Jun 2024 19:13:34 +0900 31 | Message-Id: <6668234e.e0732.58e0b9ce@df.example.jp> 32 | From: 33 | 34 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/arf-11.eml: -------------------------------------------------------------------------------- 1 | From: 2 | Date: Thu, 9 Apr 2006 23:34:45 JST 3 | Subject: FW: Nyaaan 4 | To: 5 | MIME-Version: 1.0 6 | Content-Type: multipart/report; report-type=feedback-report; boundary="fffffff_000.000000000_b" 7 | 8 | --fffffff_000.000000000_b 9 | Content-Type: text/plain; charset="US-ASCII" 10 | Content-Transfer-Encoding: 7bit 11 | 12 | This is an email abuse report for an email message received from IP 192.0.2.2 on Thu, 9 Apr 2006 23:34:45 JST. 13 | For more information about this format please see http://www.example.org/arf/. 14 | 15 | --fffffff_000.000000000_b 16 | Content-Type: message/feedback-report 17 | 18 | Feedback-Type: abuse 19 | User-Agent: ARF-Agent/1.0 20 | Version: 0.1 21 | 22 | --fffffff_000.000000000_b 23 | Content-Type: message/rfc822 24 | Content-Disposition: inline 25 | 26 | From: 27 | Received: from mx53.example.net (mx53.example.net [192.0.2.2]) 28 | by example.com with ESMTP id 00000000000fff; Thu, 09 Apr 2006 23:34:45 +0900 29 | To: 30 | Subject: Nyaaan 31 | MIME-Version: 1.0 32 | Content-type: text/plain 33 | Message-ID: ffffffffffffffffffffffffff0000000000@example.net 34 | Date: Thu, 09 Apr 2006 23:34:45 +0900 35 | 36 | Nyaaaaaaaaan 37 | --fffffff_000.000000000_b-- 38 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/arf-26.eml: -------------------------------------------------------------------------------- 1 | Date: Thu, 2 May 2024 17:48:55 +0000 (UTC) 2 | From: example@icloud.com 3 | Reply-To: example@icloud.com 4 | To: opt-out-100731.e75std53hz8rnmy4r@example.org 5 | Message-ID: <898B6152-36BC-4F4B-ABF8-2694A88CB5FC@icloud.com> 6 | Subject: unsubscribe 7 | MIME-Version: 1.0 8 | Content-Type: text/plain; charset=UTF-8 9 | Content-Transfer-Encoding: quoted-printable 10 | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=icloud.com; 11 | s=1a1hai; t=1714672136; bh=63IYtxpNtEan90vzJQT9iqnMeWHy9rlx8iFLnco1rRc=; 12 | h=Content-Type:From:Mime-Version:Date:Subject:Message-Id:To; 13 | b=AoovfvadwxCx8Pp5yD62kw1AcKMQV32RhSrBsyw4qLr/CVsQo1tIh+xCUPdI7So9i 14 | paxzn20YdVvHuP3f8CxT/q3x9WaQV3NDAmbbQumYwOpJk7yNXRkuWNjIlt6isZM0tb 15 | FK8v+Tq3j3Va83mZ6OeR8ZjvfY8ImjewEOTEZ79sNxToaaHvRuDWRbzt4uaktRuL44 16 | j1wEjiKxgy6f7bOC2XJyRaf41BtCm4V6TGtcBF9hOEMzn6LulaLgashs3yGQ92wkb9 17 | OLSy1uP0iA4nj/qAM+QaauAFzmqYmqa9r7rUFCjqf01q4gvn1QfO4QVqiRQXiMXc8e 18 | QPSqskbSbsIQA== 19 | X-Proofpoint-GUID: fiybgv3DewxSxApGH8GnpeSw3OZld4ll 20 | Auto-Submitted: auto-replied 21 | X-Apple-Unsubscribe: true 22 | X-Proofpoint-ORIG-GUID: fiybgv3DewxSxApGH8GnpeSw3OZld4ll 23 | X-Virus-Status: Clean 24 | 25 | Apple Mail sent this email to unsubscribe from the message =E2=80=9Cunsubsc= 26 | ribe=E2=80=9D. 27 | 28 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-16.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Delivered-To: nyaaaaan@nq.example.jp 3 | Received: (qmail 44594 invoked by alias); 24 Jun 2024 09:00:01 -0000 4 | Delivered-To: kijitora@nq.example.jp 5 | Received: (qmail 44591 invoked for bounce); 24 Jun 2024 09:00:01 -0000 6 | Date: 24 Jun 2024 09:00:01 -0000 7 | From: MAILER-DAEMON@nq.example.jp 8 | To: kijitora@nq.example.jp 9 | Subject: failure notice 10 | 11 | Hi. This is the qmail-send program at nq.example.jp. 12 | I'm afraid I wasn't able to deliver your message to the following addresses. 13 | This is a permanent error; I've given up. Sorry it didn't work out. 14 | 15 | : 16 | 192.0.2.25 does not like recipient. 17 | Remote host said: 550 5.1.1 : Recipient address rejected: User unknown. See https://libsisimai.org/en/reason/#userunknown 18 | Giving up on 192.0.2.25. 19 | 20 | --- Below this line is a copy of the message. 21 | 22 | Return-Path: 23 | Received: (qmail 44588 invoked by uid 0); 24 Jun 2024 09:00:01 -0000 24 | Date: 24 Jun 2024 09:00:01 -0000 25 | Message-ID: <20240624090001.44587.qmail@nq.example.jp> 26 | From: kijitora@nq.example.jp 27 | To: userunknown@libsisimai.net 28 | Subject: Nyaan? 29 | 30 | Nyaaaaaan 31 | 32 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-18.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Delivered-To: nyaaaaan@nq.example.jp 3 | Received: (qmail 44325 invoked by alias); 24 Jun 2024 08:46:37 -0000 4 | Delivered-To: kijitora@nq.example.jp 5 | Received: (qmail 44322 invoked for bounce); 24 Jun 2024 08:46:37 -0000 6 | Date: 24 Jun 2024 08:46:37 -0000 7 | From: MAILER-DAEMON@nq.example.jp 8 | To: kijitora@nq.example.jp 9 | Subject: failure notice 10 | 11 | Hi. This is the qmail-send program at nq.example.jp. 12 | I'm afraid I wasn't able to deliver your message to the following addresses. 13 | This is a permanent error; I've given up. Sorry it didn't work out. 14 | 15 | : 16 | 192.0.2.25 does not like recipient. 17 | Remote host said: 550 5.1.1 : Recipient address rejected: User unknown. See https://libsisimai.org/en/reason/#userunknown 18 | Giving up on 192.0.2.25. 19 | 20 | --- Below this line is a copy of the message. 21 | 22 | Return-Path: 23 | Received: (qmail 44319 invoked by uid 0); 24 Jun 2024 08:46:36 -0000 24 | Date: 24 Jun 2024 08:46:36 -0000 25 | Message-ID: <20240624084636.44318.qmail@nq.example.jp> 26 | From: kijitora@nq.example.jp 27 | To: userunknown@libsisimai.net 28 | Subject: Nyaan? 29 | 30 | Nyaaaaaan 31 | 32 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-v5sendmail-04.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from mx8.example.com ([192.0.2.55]) 3 | by mx6.example.com (Post.Office MTA v3.1.2 4 | release (FF000+0900) ID# 0+09000000000000000) with SMTP id 0000000 5 | for ; 6 | Thu, 29 Apr 1999 23:34:45 +0900 7 | Received: by mx8.example.com; (5.65/1.37) id 0000000; 8 | Thu, 29 Apr 1999 23:34:45 +0900 9 | Date: Thu, 29 Apr 1999 23:34:45 +0900 10 | From: Mail Delivery Subsystem 11 | Subject: Returned mail: Deferred: Host Name Lookup Failure 12 | Message-Id: <0000000000.0000000@mx8.example.com> 13 | To: shironeko@example.org 14 | 15 | ----- Transcript of session follows ----- 16 | 550 example.ed.jp (smtp)... 550 Host unknown 17 | 554 ... 550 Host unknown (Authoritative answer from name server) 18 | 550 example.ac.jp (smtp)... 550 Host unknown 19 | 554 ... 550 Host unknown (Authoritative answer from name server) 20 | 250 example.ad.jp (smtp)... 250 Deferred 21 | 22 | ----- Unsent message follows ----- 23 | Received: by mx8.example.com; (5.65/1.36) id 0000000; 24 | Thu, 29 Apr 1999 23:34:45 +0900 25 | From: shironeko@example.org 26 | To: kijitora@example.ed.jp 27 | Subject: Nyaaaaaan 28 | 29 | Nyaaan 30 | -------------------------------------------------------------------------------- /test/public/rfc791-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'sisimai/rfc791' 3 | 4 | class RFC791Test < Minitest::Test 5 | Methods = { class: %w[is_ipv4address find] } 6 | 7 | def test_is_upv4address 8 | addr0 = ["123.456.78.9"] 9 | addr1 = ["192.0.2.22"] 10 | 11 | addr0.each do |e| 12 | assert_equal false, Sisimai::RFC791.is_ipv4address(e) 13 | end 14 | addr1.each do |e| 15 | assert_equal true, Sisimai::RFC791.is_ipv4address(e) 16 | end 17 | end 18 | 19 | def test_find 20 | ip4address = [ 21 | ['host smtp.example.jp 127.0.0.4 SMTP error from remote mail server', '127.0.0.4'], 22 | ['mx.example.jp (192.0.2.2) reason: 550 5.2.0 Mail rejete.', '192.0.2.2'], 23 | ['Client host [192.0.2.49] blocked using cbl.abuseat.org (state 13).', '192.0.2.49'], 24 | ['127.0.0.1', '127.0.0.1'], 25 | ['365.31.7.1', ''], 26 | ['a.b.c.d', ''], 27 | ] 28 | ip4address.each do |e| 29 | assert_equal e[1], Sisimai::RFC791.find(e[0]).shift.to_s 30 | end 31 | assert_nil Sisimai::RFC791.find('') 32 | assert_instance_of Array, Sisimai::RFC791.find('3.14') 33 | 34 | ce = assert_raises ArgumentError do 35 | Sisimai::RFC791.find() 36 | Sisimai::RFC791.find("nekochan", nil) 37 | end 38 | end 39 | 40 | end 41 | 42 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/arf-12.eml: -------------------------------------------------------------------------------- 1 | From: 2 | Date: Thu, 9 Apr 2006 23:34:45 JST 3 | Subject: FW: Nyaaan 4 | To: 5 | MIME-Version: 1.0 6 | Content-Type: multipart/report; report-type=feedback-report; 7 | boundary="bx1111_00.ffffffffffff" 8 | 9 | --bx1111_00.ffffffffffff 10 | Content-Type: text/plain; charset="US-ASCII" 11 | Content-Transfer-Encoding: 7bit 12 | 13 | This is an opt-out report for an email message received from IP 14 | 192.0.2.89 on Thu, 9 Apr 2006 23:34:45 JST. For more information 15 | about this format please see http://www.example.org/arf/. 16 | 17 | --bx1111_00.ffffffffffff 18 | Content-Type: message/feedback-report 19 | 20 | Feedback-Type: opt-out 21 | User-Agent: ARF-Agent/1.0 22 | Version: 0.1 23 | Removal-Recipient: user@example.com 24 | 25 | --bx1111_00.ffffffffffff 26 | Content-Type: text/rfc822-header 27 | 28 | From: 29 | Received: from mx90.example.net (mx90.example.net [192.0.2.89]) 30 | by example.com with ESMTP id ffffffffffff00; Thu, 09 Apr 2006 23:34:45 +0900 31 | To: 32 | Subject: Nyaaan 33 | MIME-Version: 1.0 34 | Content-type: text/plain 35 | Message-ID: 0000000000000000000000000@example.net 36 | Date: Thu, 02 Sep 2006 23:34:45 +0900 37 | 38 | Nyaaaan 39 | --bx1111_00.ffffffffffff-- 40 | 41 | -------------------------------------------------------------------------------- /test/public/rhost-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | require 'sisimai/rhost' 3 | require 'sisimai' 4 | 5 | class RhostTest < Minitest::Test 6 | Methods = { class: %w[name find] } 7 | Classes = %w[ 8 | Aol Apple Cloudflare Cox Facebook FrancePTT GoDaddy Google GSuite IUA KDDI MessageLabs Microsoft 9 | Mimecast NTTDOCOMO Outlook Spectrum Tencent YahooInc 10 | ] 11 | Objects = [] 12 | 13 | def test_methods 14 | Methods[:class].each { |e| assert_respond_to Sisimai::Rhost, e } 15 | end 16 | 17 | def test_name 18 | Dir.glob('./set-of-emails/maildir/bsd/rhost-*.eml').each do |e| 19 | cv = Sisimai.rise(e); assert_instance_of Array, cv 20 | cv.each do |ee| 21 | assert_instance_of Sisimai::Fact, ee 22 | fo = ee.damn 23 | cx = Sisimai::Rhost.name(fo); refute_empty cx 24 | Objects << fo 25 | end 26 | end 27 | 28 | ce = assert_raises ArgumentError do 29 | Sisimai::Rhost.name() 30 | Sisimai::Rhost.name(nil, nil) 31 | end 32 | end 33 | 34 | def test_find 35 | Objects.each do |fo| 36 | cr = Sisimai::Rhost.find(fo); assert_instance_of ::String, cr 37 | 38 | ce = assert_raises ArgumentError do 39 | Sisimai::Rhost.find() 40 | Sisimai::Rhost.find(nil, nil) 41 | end 42 | end 43 | end 44 | end 45 | 46 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-04.eml: -------------------------------------------------------------------------------- 1 | Received: (qmail 1111 invoked for bounce); 29 Apr 2010 00:00:00 -0000 2 | Date: 29 Apr 2010 00:00:00 -0000 3 | From: MAILER-DAEMON@nijo.example.jp 4 | To: root@nijo.example.jp 5 | Subject: failure notice 6 | 7 | Hi. This is the qmail-send program at mx.example.jp. 8 | I'm afraid I wasn't able to deliver your message to the following addresses. 9 | This is a permanent error; I've given up. Sorry it didn't work out. 10 | 11 | : 12 | Connected to 192.0.2.112 but my name was rejected. 13 | Remote host said: 501 5.0.0 Invalid domain name 14 | I'm not going to try again; this message has been in the queue too long. 15 | 16 | --- Below this line is a copy of the message. 17 | 18 | Return-Path: 19 | Received: (qmail 0000 invoked from network); 29 Apr 2010 23:45:43 -0000 20 | Received: from unknown (HELO example.jp) (192.0.2.24) 21 | by mx.example.jp with SMTP; 29 Apr 2010 23:45:43 -0000 22 | Message-ID: <00000000.000000000@example.jp> 23 | Date: Thu, 29 Apr 2010 23:45:40 +0900 24 | From: Shironeko 25 | MIME-Version: 1.0 26 | To: "Kijitora Cat" 27 | Subject: Nyaaaaaaaaaaaaaaaaaaaaaaaaaaan 28 | Content-Type: text/plain; charset=us-ascii; format=flowed 29 | Content-Transfer-Encoding: 7bit 30 | 31 | Nyaa 32 | -------------------------------------------------------------------------------- /lib/sisimai/fact/json.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | class Fact 3 | # Sisimai::Fact::JSON dumps decoded data object as a JSON format. This class and method should 4 | # be called from the parent object "Sisimai::Fact". 5 | module JSON 6 | class << self 7 | # Serializer (JSON) 8 | # @param [Sisimai::Fact] argvs Object 9 | # @return [String] Dumped data or an empty string if the argument is missing 10 | def dump(argvs) 11 | return "" if argvs.nil? || argvs.is_a?(Sisimai::Fact) == false 12 | 13 | if RUBY_PLATFORM.start_with?('java') 14 | # java-based ruby environment like JRuby. 15 | begin 16 | require 'jrjackson' 17 | jsonstring = JrJackson::Json.dump(argvs.damn) 18 | rescue StandardError => ce 19 | warn '***warning: Failed to JrJackson::Json.dump: ' + ce.to_s 20 | end 21 | else 22 | # MRI 23 | begin 24 | require 'oj' 25 | jsonstring = Oj.dump(argvs.damn, :mode => :compat) 26 | rescue StandardError => ce 27 | warn '***warning: Failed to Oj.dump: ' + ce.to_s 28 | end 29 | end 30 | 31 | return jsonstring 32 | end 33 | 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-opensmtpd-02.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Received: from vagrant-centos65.example.com (c21352.kyoto.example.ne.jp [192.0.2.135]) 3 | by aneyakoji.example.jp (V8/cf) with ESMTP id s6HAuIEE027507 4 | for ; Thu, 17 Jul 2014 19:56:19 +0900 5 | Message-Id: <201407171056.s6HAuIEE027507@aneyakoji.example.jp> 6 | Received: from localhost (localhost [local]); 7 | by localhost (OpenSMTPD) with ESMTPA id 700fd087; 8 | for ; 9 | Thu, 17 Jul 2014 11:15:48 +0000 (UTC) 10 | Subject: Delivery status notification: error 11 | From: Mailer Daemon 12 | To: kijitora@example.jp 13 | Date: Thu, 17 Jul 2014 11:15:48 +0000 (UTC) 14 | 15 | Hi! 16 | 17 | This is the MAILER-DAEMON, please DO NOT REPLY to this e-mail. 18 | 19 | An error has occurred while attempting to deliver a message for 20 | the following list of recipients: 21 | 22 | mailboxfull@example.jp: 550 5.2.2 ... Mailbox Full 23 | userunknown@example.jp: 550 5.1.1 ... User Unknown 24 | 25 | Below is a copy of the original message: 26 | 27 | Received: from [127.0.0.1] (localhost [127.0.0.1]); 28 | by localhost (OpenSMTPD) with ESMTP id 966254b0; 29 | Thu, 17 Jul 2014 11:15:29 +0000 (UTC) 30 | Subject: test from OpenSMTPD 31 | From: kijitora@example.jp 32 | 33 | test 34 | -------------------------------------------------------------------------------- /test/public/lhost-opensmtpd.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Public 2 | module OpenSMTPD 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '01' => [['5.1.1', '550', 'userunknown', true, true]], 6 | '02' => [['5.2.2', '550', 'mailboxfull', false, true], 7 | ['5.1.1', '550', 'userunknown', true, true]], 8 | '03' => [['5.0.912', '', 'hostunknown', true, true]], 9 | '04' => [['5.0.944', '', 'networkerror', false, false]], 10 | '05' => [['5.0.947', '', 'expired', false, false]], 11 | '06' => [['5.0.947', '', 'expired', false, false]], 12 | '10' => [['5.0.912', '', 'hostunknown', true, true]], 13 | '11' => [['5.7.26', '550', 'authfailure', false, false]], 14 | '12' => [['5.0.932', '', 'notaccept', true, true]], 15 | '13' => [['4.7.0', '421', 'badreputation', false, false]], 16 | '14' => [['5.7.25', '550', 'requireptr', false, false]], 17 | '15' => [['5.0.947', '', 'expired', false, false]], 18 | '16' => [['5.0.947', '', 'expired', false, false]], 19 | '17' => [['5.1.1', '550', 'userunknown', true, true], 20 | ['5.2.2', '552', 'mailboxfull', false, true]], 21 | } 22 | end 23 | end 24 | 25 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-domino-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from mta52.example.jp (mta52.example.jp [192.0.2.89]) 3 | by mx.example.com (8.14.1/8.12.11) with ESMTP id o000000000 4 | for ; Tue, 29 Apr 2010 10:45:04 -0700 5 | Received: from mta52.example.jp (MTAXYZ [127.0.0.1]) 6 | by mx0.example.jp (localhost) with ESMTP id 0000000000 7 | for ; Tue, 29 Apr 2010 12:34:45 +0900 (JST) 8 | Received: from x.mail.example.jp (x.mail.example.jp [192.0.2.25]) 9 | by mta52.example.jp (localhost) with ESMTP id 8888888888 10 | for ; Tue, 29 Apr 2010 12:34:45 +0900 (JST) 11 | Date: Tue, 29 Apr 2010 10:54:01 -0700 12 | MIME-Version: 1.0 13 | From: Postmaster@example.jp 14 | To: Sender Address 15 | Subject: DELIVERY FAILURE: User Kijitoranyan (kijitora@example.jp) not listed in 16 | Domino Directory 17 | X-OriginalArrivalTime: 29 Apr 2010 19:02:59.0038 (UTC) FILETIME=[00000000:00000000] 18 | Message-ID: <0000000000.000000000-000000000.00000000-00000000.00000000@example.com> 19 | Content-Type: Text/Plain 20 | Content-Transfer-Encoding: 8bit 21 | 22 | Your message 23 | 24 | Subject: Test Bounce 25 | 26 | was not delivered to: 27 | 28 | kijitora@example.jp 29 | 30 | because: 31 | 32 | User some.name (kijitora@example.jp) not listed in Domino Directory 33 | 34 | -------------------------------------------------------------------------------- /lib/sisimai/rfc5965.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | # Sisimai::RFC5965 - A class for An Extensible Format for Email Feedback Reports 3 | module RFC5965 4 | class << self 5 | # https://datatracker.ietf.org/doc/html/rfc5965 6 | def FIELDINDEX 7 | return [ 8 | # Required Fields 9 | # The following report header fields MUST appear exactly once: 10 | 'Feedback-Type', 'User-Agent', 'Version', 11 | 12 | # Optional Fields Appearing Once 13 | # The following header fields are optional and MUST NOT appear more than once: 14 | # - "Reporting-MTA" is defined in Sisimai::RFC1894->FIELDINDEX() 15 | 'Original-Envelope-Id', 'Original-Mail-From', 'Arrival-Date', 'Source-IP', 'Incidents', 16 | 17 | # Optional Fields Appearing Multiple Times 18 | # The following set of header fields are optional and may appear any number of times as 19 | # appropriate: 20 | 'Authentication-Results', 'Original-Rcpt-To', 'Reported-Domain', 'Reported-URI', 21 | 22 | # The historic field "Received-Date" SHOULD also be accepted and interpreted identically 23 | # to "Arrival-Date". However, if both are present, the report is malformed and SHOULD be 24 | # treated as described in Section 4. 25 | 'Received-Date', 26 | ] 27 | end 28 | end 29 | end 30 | end 31 | 32 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-exim-52.eml: -------------------------------------------------------------------------------- 1 | Return-path: <> 2 | Envelope-to: sironeko@neko.example.com 3 | Delivery-date: Thu, 29 Apr 2016 23:45:56 +0900 4 | Received: from nekochan by neko.example.com with local (Exim 4.86) 5 | id 2neko2-222222-22 6 | for sironeko@neko.example.com; Thu, 29 Apr 2016 23:45:56 +0900 7 | Auto-Submitted: auto-replied 8 | From: Mail Delivery System 9 | To: sironeko@neko.example.com 10 | Subject: Mail failure - malformed recipient address 11 | Message-Id: 12 | Date: Thu, 29 Apr 2016 23:45:56 +0900 13 | 14 | A message that you sent contained one or more recipient addresses that were 15 | incorrectly constructed: 16 | 17 | kijitora@example.com : malformed address: may not follow kijitora@example.com 18 | 19 | This address has been ignored. The other addresses in the message were 20 | syntactically valid and have been passed on for an attempt at delivery. 21 | 22 | ------ This is a copy of your message, including all the headers. ------ 23 | 24 | To: neko@example.net 25 | Subject: Nyaan 26 | MIME-Version: 1.0 27 | Content-type: text/html; charset=utf-8 28 | To: kijitora@example.com 29 | From: "Sironeko" 30 | Message-Id: <2222CAT-222222-22@neko.example.com> 31 | Date: Thu, 29 Apr 2016 23:45:56 +0900 32 | 33 | Nyaan 34 | 35 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-x2-06.eml: -------------------------------------------------------------------------------- 1 | Return-path: 2 | Received: from e3.rr.example.net [203.0.113.225] by r0.example.com [192.0.2.55] 3 | with SMTP (postmaster.v3.5.6) for ; 4 | Thu, 29 Apr 2005 23:34:45 +0000 5 | Received: from e3.rr.example.net for kijitora@neko.example.com; 6 | Apr 29 23:34:45 2005 +0000 7 | Message-ID: <20050429233445.999999.ee@e3.rr.example.net> 8 | Date: 29 Apr 2005 23:34:45 -0000 9 | From: MAILER-DAEMON@example.net 10 | To: sironeko@example.org 11 | Subject: Permanent Delivery Failure 12 | 13 | Message from example.com. 14 | Unable to deliver message to the following address(es). 15 | 16 | : 17 | Sorry, I wasn't able to establish an SMTP connection. (#4.4.1) 18 | I'm not going to try again; this message has been in the queue too long. 19 | 20 | --- Original message follows. 21 | 22 | Return-Path: 23 | Received: from r7.e.example.or.jp (HELO localhost) (203.0.113.90) 24 | by smtp1.r5.esample.com with SMTP; 29 Apr 2005 23:34:45 +0000 25 | From: Sironeko 26 | To: kijitora-nyaan@neko.example.com 27 | Date: Thu, 29 Apr 2005 23:34:45 +0000 28 | Subject: Nyaan 29 | MIME-Version: 1.0 30 | Content-Type: text/plain; charset=iso-8859-1 31 | Content-Transfer-Encoding: 7bit 32 | 33 | Nyaan 34 | 35 | --0000-ffff-0022-x8sub924ga-- 36 | 37 | -------------------------------------------------------------------------------- /test/public/sample-emails-test.rb: -------------------------------------------------------------------------------- 1 | require 'minitest/autorun' 2 | class PublicSampleEmailTest < Minitest::Test 3 | Samples = [ 4 | './set-of-emails/mailbox', 5 | './set-of-emails/maildir/err', 6 | './set-of-emails/maildir/bsd', 7 | './set-of-emails/maildir/dos', 8 | './set-of-emails/to-be-debugged-because/something-is-wrong', 9 | './set-of-emails/to-be-parsed-for-test' 10 | ] 11 | 12 | def test_publicsamples 13 | Samples.each do |de| 14 | assert_equal true, File.exist?(de) 15 | assert_equal true, File.readable?(de) 16 | assert_equal true, File.executable?(de) 17 | 18 | dr = Dir.open(de) 19 | while ce = dr.read do 20 | next if ce == '.' 21 | next if ce == '..' 22 | 23 | emailfn = sprintf("%s/%s", de, ce) 24 | lnindex = 0 25 | 26 | assert_equal true, File.exist?(emailfn), sprintf("%s: FILE", ce) 27 | assert_equal true, File.readable?(emailfn), sprintf("%s: READ", ce) 28 | assert_equal false, File.empty?(emailfn), sprintf("%s: SIZE", ce) 29 | 30 | fhandle = File.open(emailfn, 'r') 31 | while r = fhandle.read do 32 | lnindex += 1 33 | assert_match /\x0a\z/, r.scrub, sprintf("%s: LINE(%02d)", ce, lnindex) 34 | break 35 | end 36 | fhandle.close 37 | end 38 | 39 | dr.close 40 | end 41 | end 42 | end 43 | 44 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-opensmtpd-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Received: from vagrant-centos65.example.com (c213502.kyoto.example.ne.jp [192.0.2.135]) 3 | by aneyakoji.example.jp (V8/cf) with ESMTP id s6HB0VsJ028505 4 | for ; Thu, 17 Jul 2014 20:00:32 +0900 5 | Message-Id: <201407171100.s6HB0VsJ028505@aneyakoji.example.jp> 6 | Received: from localhost (localhost [local]); 7 | by localhost (OpenSMTPD) with ESMTPA id 1e2a9eaa; 8 | for ; 9 | Thu, 17 Jul 2014 11:20:14 +0000 (UTC) 10 | Subject: Delivery status notification: error 11 | From: Mailer Daemon 12 | To: kijitora@example.jp 13 | Date: Thu, 17 Jul 2014 11:20:14 +0000 (UTC) 14 | 15 | Hi! 16 | 17 | This is the MAILER-DAEMON, please DO NOT REPLY to this e-mail. 18 | 19 | An error has occurred while attempting to deliver a message for 20 | the following list of recipients: 21 | 22 | apdugoaidugoaidugoaeiudggadi@gmail.com: 550 5.1.1 http://support.google.com/mail/bin/answer.py?answer=6596 ad1si1997204pbd.83 - gsmtp 23 | 24 | Below is a copy of the original message: 25 | 26 | Received: from [127.0.0.1] (localhost [127.0.0.1]); 27 | by localhost (OpenSMTPD) with ESMTP id d70f9624; 28 | for ; 29 | Thu, 17 Jul 2014 11:19:54 +0000 (UTC) 30 | Subject: test from OpenSMTPD 31 | From: kijitora@example.jp 32 | 33 | test 34 | -------------------------------------------------------------------------------- /set-of-emails/maildir/dos/lhost-mailmarshalsmtp-01.eml: -------------------------------------------------------------------------------- 1 | Received: from MailMarshal.Sender ([127.0.0.1]) by relay.xxxxxxxxx.com 2 | id ; Mon, 22 Dec 2014 16:21:07 +0000 3 | Message-ID: 4 | From: postmaster@igfej.xxxxxxxxxxxx.com 5 | To: originalsender@example.com 6 | CC: 7 | Date: Mon, 22 Dec 2014 16:21:07 +0000 8 | Subject: Undeliverable Mail: "IIdentificaゥンゥルo" 9 | MIME-Version: 1.0 10 | Content-Type: multipart/mixed; 11 | boundary="--=30ecf893-1096-4eca-ba85-bc3fca72024d" 12 | 13 | 14 | ----=30ecf893-1096-4eca-ba85-bc3fca72024d 15 | Content-Type: text/plain; 16 | charset="iso-8859-1" 17 | Content-Transfer-Encoding: 7bit 18 | 19 | Your message: 20 | From: originalsender@example.com 21 | Subject: IIdentificaゥンゥルo 22 | 23 | Could not be delivered because of 24 | 25 | 550 5.1.1 User unknown 26 | 27 | The following recipients were affected: 28 | dummyuser@blabla.xxxxxxxxxxxx.com 29 | 30 | 31 | 32 | 33 | Additional Information 34 | ====================== 35 | Original Sender: 36 | Sender-MTA: <10.11.12.13> 37 | Remote-MTA: <10.0.0.1> 38 | Reporting-MTA: 39 | MessageName: 40 | Last-Attempt-Date: <16:21:07 seg, 22 Dezembro 2014> 41 | 42 | ----=30ecf893-1096-4eca-ba85-bc3fca72024d-- 43 | 44 | -------------------------------------------------------------------------------- /test/private/lhost-aol.rb: -------------------------------------------------------------------------------- 1 | module LhostEngineTest::Private 2 | module Aol 3 | IsExpected = { 4 | # INDEX => [['D.S.N.', 'replycode', 'REASON', 'hardbounce', 'toxic'], [...]] 5 | '1001' => [['5.4.4', '', 'hostunknown', true, true]], 6 | '1002' => [['5.2.2', '550', 'mailboxfull', false, true]], 7 | '1003' => [['5.2.2', '550', 'mailboxfull', false, true], 8 | ['5.1.1', '550', 'userunknown', true, true]], 9 | '1004' => [['5.2.2', '550', 'mailboxfull', false, true], 10 | ['5.1.1', '550', 'userunknown', true, true]], 11 | '1005' => [['5.1.1', '550', 'userunknown', true, true]], 12 | '1006' => [['5.1.1', '550', 'userunknown', true, true]], 13 | '1007' => [['5.2.2', '552', 'mailboxfull', false, true]], 14 | '1008' => [['5.7.1', '554', 'filtered', false, true]], 15 | '1009' => [['5.7.1', '554', 'policyviolation', false, false]], 16 | '1010' => [['5.7.1', '554', 'filtered', false, true]], 17 | '1011' => [['5.7.1', '554', 'filtered', false, true]], 18 | '1012' => [['5.2.2', '552', 'mailboxfull', false, true]], 19 | '1013' => [['5.2.2', '552', 'mailboxfull', false, true]], 20 | '1014' => [['5.1.1', '550', 'userunknown', true, true]], 21 | } 22 | end 23 | end 24 | 25 | -------------------------------------------------------------------------------- /lib/sisimai/rhost/kddi.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | module Rhost 3 | # Sisimai::Rhost detects the bounce reason from the content of Sisimai::Fact object as an argument 4 | # of find() method when the value of "rhost" of the object is "lsean.ezweb.ne.jp" or "msmx.au.com". 5 | # This class is called only Sisimai::Fact class. 6 | module KDDI 7 | class << self 8 | MessagesOf = { 9 | 'filtered' => '550 : user unknown', # The response was: 550 : User unknown 10 | 'userunknown' => '>: user unknown', # The response was: 550 <...>: User unknown 11 | }.freeze 12 | 13 | # Detect bounce reason from au (KDDI) 14 | # @param [Sisimai::Fact] argvs Decoded email object 15 | # @return [String] The bounce reason for au.com or ezweb.ne.jp 16 | # @since v4.22.6 17 | def find(argvs) 18 | return "" if argvs["diagnosticcode"].empty? 19 | issuedcode = argvs['diagnosticcode'].downcase 20 | reasontext = '' 21 | 22 | MessagesOf.each_key do |e| 23 | # Try to match the error message with message patterns defined in $MessagesOf 24 | next if issuedcode.include?(MessagesOf[e]) == false 25 | reasontext = e 26 | break 27 | end 28 | 29 | return reasontext 30 | end 31 | 32 | end 33 | end 34 | end 35 | end 36 | 37 | 38 | -------------------------------------------------------------------------------- /set-of-emails/maildir/dos/lhost-domino-01.eml: -------------------------------------------------------------------------------- 1 | Return-Path: 2 | Received: from mta52.example.jp (mta52.example.jp [192.0.2.89]) 3 | by mx.example.com (8.14.1/8.12.11) with ESMTP id o000000000 4 | for ; Tue, 29 Apr 2010 10:45:04 -0700 5 | Received: from mta52.example.jp (MTAXYZ [127.0.0.1]) 6 | by mx0.example.jp (localhost) with ESMTP id 0000000000 7 | for ; Tue, 29 Apr 2010 12:34:45 +0900 (JST) 8 | Received: from x.mail.example.jp (x.mail.example.jp [192.0.2.25]) 9 | by mta52.example.jp (localhost) with ESMTP id 8888888888 10 | for ; Tue, 29 Apr 2010 12:34:45 +0900 (JST) 11 | Date: Tue, 29 Apr 2010 10:54:01 -0700 12 | MIME-Version: 1.0 13 | From: Postmaster@example.jp 14 | To: Sender Address 15 | Subject: DELIVERY FAILURE: User Kijitoranyan (kijitora@example.jp) not listed in 16 | Domino Directory 17 | X-OriginalArrivalTime: 29 Apr 2010 19:02:59.0038 (UTC) FILETIME=[00000000:00000000] 18 | Message-ID: <0000000000.000000000-000000000.00000000-00000000.00000000@example.com> 19 | Content-Type: Text/Plain 20 | Content-Transfer-Encoding: 8bit 21 | 22 | Your message 23 | 24 | Subject: Test Bounce 25 | 26 | was not delivered to: 27 | 28 | kijitora@example.jp 29 | 30 | because: 31 | 32 | User some.name (kijitora@example.jp) not listed in Domino Directory 33 | 34 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-imailserver-02.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | X-Original-To: shironeko@example.jp 3 | Delivered-To: shironeko@example.jp 4 | Received: from mx9.example.co.jp (unknown [192.0.2.126]) 5 | by mx.example.jp (Postfix) with ESMTP id 0000000000 6 | for ; Thu, 29 Apr 2010 23:45:10 +0900 (JST) 7 | Date: Thu, 29 Apr 2010 23:45:10 +0900 8 | Message-Id: <00000000000.0000000@example.co.jp> 9 | Mime-Version: 1.0 10 | Content-Type: text/plain; charset=us-ascii 11 | From: "Postmaster" 12 | Sender: 13 | To: shironeko@example.jp 14 | Subject: Undeliverable Mail 15 | X-Mailer: 16 | 17 | User mailbox exceeds allowed size: kijitora@example.co.jp 18 | 19 | 20 | Original message follows. 21 | 22 | Received: from smtp8.relay1.example.ne.jp [192.0.2.209] by mx4.example.co.jp 23 | (SMTPD-8.22) id 00000000; Thu, 29 Apr 2010 23:45:10 +0900 24 | Received: from unknown (HELO smtp5.example.ne.jp) (192.0.2.201) 25 | by 0 with SMTP; 29 Apr 2010 23:45:10 -0000 26 | Message-ID: <00000000000000000000000@smtp5.example.ne.jp> 27 | Date: Thu, 29 Apr 2010 23:45:10 +0900 (JST) 28 | From: Shironeko 29 | Reply-To: neko@example.ne.jp 30 | To: kijitora@example.co.jp 31 | Subject: Nyaaaan 32 | MIME-Version: 1.0 33 | Content-Type: text/plain; charset=ISO-2022-JP 34 | Content-Transfer-Encoding: 7bit 35 | 36 | Nyaan 37 | -------------------------------------------------------------------------------- /set-of-emails/maildir/bsd/lhost-qmail-19.eml: -------------------------------------------------------------------------------- 1 | Return-Path: <> 2 | Delivered-To: nyaaaaan@nq.example.jp 3 | Received: (qmail 3019 invoked by alias); 25 Jun 2024 10:36:44 -0000 4 | Delivered-To: kijitora@nq.example.jp 5 | Received: (qmail 3016 invoked for bounce); 25 Jun 2024 10:36:44 -0000 6 | Date: 25 Jun 2024 10:36:44 -0000 7 | From: MAILER-DAEMON@nq.example.jp 8 | To: kijitora@nq.example.jp 9 | Subject: failure notice 10 | 11 | Hi. This is the qmail-send program at nq.example.jp. 12 | I'm afraid I wasn't able to deliver your message to the following addresses. 13 | This is a permanent error; I've given up. Sorry it didn't work out. 14 | 15 | : 16 | Connected to 98.136.96.74 but sender was rejected. 17 | Remote host said: 421 4.7.0 [TSS04] Messages from 192.0.2.25 temporarily deferred due to unexpected volume or user complaints - 4.16.55.1; see https://postmaster.yahooinc.com/error-codes 18 | I'm not going to try again; this message has been in the queue too long. 19 | 20 | --- Below this line is a copy of the message. 21 | 22 | Return-Path: 23 | Received: (qmail 40682 invoked by uid 0); 24 Jun 2024 06:10:02 -0000 24 | Date: 24 Jun 2024 06:10:02 -0000 25 | Message-ID: <20240624061002.40681.qmail@nq.example.jp> 26 | From: nyaaaaan@nq.example.jp 27 | To: pseudo-local-part-of-yahoo-inc@yahoo.com 28 | Subject: Nyaan? 29 | 30 | Nyaaaaaan 31 | 32 | -------------------------------------------------------------------------------- /lib/sisimai/rhost/outlook.rb: -------------------------------------------------------------------------------- 1 | module Sisimai 2 | module Rhost 3 | # Sisimai::Rhost detects the bounce reason from the content of Sisimai::Fact object as an argument 4 | # of find() method when the value of "rhost" of the object is "*.hotmail.com". This class is called 5 | # only from Sisimai::Fact class. 6 | module Outlook 7 | class << self 8 | MessagesOf = { 9 | "hostunknown" => ["The mail could not be delivered to the recipient because the domain is not reachable"], 10 | "userunknown" => ["Requested action not taken: mailbox unavailable"], 11 | }.freeze 12 | 13 | # Detect bounce reason from Microsoft Outlook.com: https://www.outlook.com/ 14 | # @param [Sisimai::Fact] argvs Decoded email object 15 | # @return [String] The bounce reason for Outlook 16 | # @since v5.2.0 17 | def find(argvs) 18 | return "" if argvs["diagnosticcode"].empty? 19 | issuedcode = argvs["diagnosticcode"] 20 | reasontext = "" 21 | 22 | MessagesOf.each_key do |e| 23 | # Try to match the error message with message patterns defined in $MessagesOf 24 | next if MessagesOf[e].none? { |a| issuedcode.include?(a) } 25 | reasontext = e 26 | break 27 | end 28 | 29 | return reasontext 30 | end 31 | 32 | end 33 | end 34 | end 35 | end 36 | 37 | --------------------------------------------------------------------------------