sisimai 4.14.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sisimai might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.rubocop.yml +165 -0
- data/.travis.yml +21 -0
- data/ANALYTICAL-PRECISION +54 -0
- data/Changes +5 -0
- data/Developers.mk +129 -0
- data/Gemfile +9 -0
- data/LICENSE +26 -0
- data/Makefile +56 -0
- data/README.md +300 -0
- data/Rakefile +7 -0
- data/Repository.mk +69 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/sisimai.rb +60 -0
- data/lib/sisimai/address.rb +218 -0
- data/lib/sisimai/arf.rb +343 -0
- data/lib/sisimai/data.rb +413 -0
- data/lib/sisimai/data/json.rb +36 -0
- data/lib/sisimai/data/yaml.rb +32 -0
- data/lib/sisimai/datetime.rb +518 -0
- data/lib/sisimai/mail.rb +82 -0
- data/lib/sisimai/mail/maildir.rb +85 -0
- data/lib/sisimai/mail/mbox.rb +69 -0
- data/lib/sisimai/mail/stdin.rb +52 -0
- data/lib/sisimai/mda.rb +152 -0
- data/lib/sisimai/message.rb +510 -0
- data/lib/sisimai/mime.rb +127 -0
- data/lib/sisimai/msp.rb +54 -0
- data/lib/sisimai/msp/de/einsundeins.rb +174 -0
- data/lib/sisimai/msp/de/gmx.rb +197 -0
- data/lib/sisimai/msp/jp/biglobe.rb +179 -0
- data/lib/sisimai/msp/jp/ezweb.rb +292 -0
- data/lib/sisimai/msp/jp/kddi.rb +195 -0
- data/lib/sisimai/msp/ru/mailru.rb +306 -0
- data/lib/sisimai/msp/ru/yandex.rb +241 -0
- data/lib/sisimai/msp/uk/messagelabs.rb +250 -0
- data/lib/sisimai/msp/us/amazonses.rb +248 -0
- data/lib/sisimai/msp/us/aol.rb +234 -0
- data/lib/sisimai/msp/us/bigfoot.rb +243 -0
- data/lib/sisimai/msp/us/facebook.rb +306 -0
- data/lib/sisimai/msp/us/google.rb +357 -0
- data/lib/sisimai/msp/us/outlook.rb +243 -0
- data/lib/sisimai/msp/us/receivingses.rb +247 -0
- data/lib/sisimai/msp/us/sendgrid.rb +257 -0
- data/lib/sisimai/msp/us/verizon.rb +311 -0
- data/lib/sisimai/msp/us/yahoo.rb +178 -0
- data/lib/sisimai/msp/us/zoho.rb +198 -0
- data/lib/sisimai/mta.rb +55 -0
- data/lib/sisimai/mta/activehunter.rb +155 -0
- data/lib/sisimai/mta/apachejames.rb +194 -0
- data/lib/sisimai/mta/courier.rb +307 -0
- data/lib/sisimai/mta/domino.rb +209 -0
- data/lib/sisimai/mta/exchange.rb +314 -0
- data/lib/sisimai/mta/exim.rb +549 -0
- data/lib/sisimai/mta/imailserver.rb +227 -0
- data/lib/sisimai/mta/interscanmss.rb +167 -0
- data/lib/sisimai/mta/mailfoundry.rb +173 -0
- data/lib/sisimai/mta/mailmarshalsmtp.rb +206 -0
- data/lib/sisimai/mta/mcafee.rb +201 -0
- data/lib/sisimai/mta/messagingserver.rb +241 -0
- data/lib/sisimai/mta/mfilter.rb +190 -0
- data/lib/sisimai/mta/mxlogic.rb +283 -0
- data/lib/sisimai/mta/notes.rb +206 -0
- data/lib/sisimai/mta/opensmtpd.rb +225 -0
- data/lib/sisimai/mta/postfix.rb +306 -0
- data/lib/sisimai/mta/qmail.rb +335 -0
- data/lib/sisimai/mta/sendmail.rb +317 -0
- data/lib/sisimai/mta/surfcontrol.rb +193 -0
- data/lib/sisimai/mta/userdefined.rb +148 -0
- data/lib/sisimai/mta/v5sendmail.rb +232 -0
- data/lib/sisimai/mta/x1.rb +156 -0
- data/lib/sisimai/mta/x2.rb +157 -0
- data/lib/sisimai/mta/x3.rb +171 -0
- data/lib/sisimai/mta/x4.rb +365 -0
- data/lib/sisimai/mta/x5.rb +208 -0
- data/lib/sisimai/order.rb +217 -0
- data/lib/sisimai/reason.rb +235 -0
- data/lib/sisimai/reason/blocked.rb +105 -0
- data/lib/sisimai/reason/contenterror.rb +53 -0
- data/lib/sisimai/reason/exceedlimit.rb +60 -0
- data/lib/sisimai/reason/expired.rb +53 -0
- data/lib/sisimai/reason/filtered.rb +98 -0
- data/lib/sisimai/reason/hasmoved.rb +45 -0
- data/lib/sisimai/reason/hostunknown.rb +74 -0
- data/lib/sisimai/reason/mailboxfull.rb +118 -0
- data/lib/sisimai/reason/mailererror.rb +55 -0
- data/lib/sisimai/reason/mesgtoobig.rb +77 -0
- data/lib/sisimai/reason/networkerror.rb +57 -0
- data/lib/sisimai/reason/norelaying.rb +71 -0
- data/lib/sisimai/reason/notaccept.rb +63 -0
- data/lib/sisimai/reason/onhold.rb +45 -0
- data/lib/sisimai/reason/rejected.rb +101 -0
- data/lib/sisimai/reason/securityerror.rb +72 -0
- data/lib/sisimai/reason/spamdetected.rb +172 -0
- data/lib/sisimai/reason/suspend.rb +58 -0
- data/lib/sisimai/reason/systemerror.rb +69 -0
- data/lib/sisimai/reason/systemfull.rb +45 -0
- data/lib/sisimai/reason/toomanyconn.rb +73 -0
- data/lib/sisimai/reason/userunknown.rb +194 -0
- data/lib/sisimai/rfc2606.rb +24 -0
- data/lib/sisimai/rfc3464.rb +497 -0
- data/lib/sisimai/rfc3834.rb +150 -0
- data/lib/sisimai/rfc5322.rb +204 -0
- data/lib/sisimai/rhost.rb +47 -0
- data/lib/sisimai/rhost/googleapps.rb +237 -0
- data/lib/sisimai/smtp.rb +58 -0
- data/lib/sisimai/smtp/reply.rb +81 -0
- data/lib/sisimai/smtp/status.rb +755 -0
- data/lib/sisimai/string.rb +65 -0
- data/lib/sisimai/time.rb +11 -0
- data/lib/sisimai/version.rb +4 -0
- data/set-of-emails/README.md +35 -0
- data/set-of-emails/mailbox/mbox-0 +2467 -0
- data/set-of-emails/mailbox/mbox-1 +71 -0
- data/set-of-emails/maildir/bsd/README.md +261 -0
- data/set-of-emails/maildir/bsd/activehunter-01.eml +54 -0
- data/set-of-emails/maildir/bsd/activehunter-02.eml +53 -0
- data/set-of-emails/maildir/bsd/apachejames-01.eml +46 -0
- data/set-of-emails/maildir/bsd/arf-01.eml +66 -0
- data/set-of-emails/maildir/bsd/arf-02.eml +68 -0
- data/set-of-emails/maildir/bsd/arf-03.eml +56 -0
- data/set-of-emails/maildir/bsd/arf-04.eml +89 -0
- data/set-of-emails/maildir/bsd/arf-05.eml +82 -0
- data/set-of-emails/maildir/bsd/arf-06.eml +166 -0
- data/set-of-emails/maildir/bsd/arf-07.eml +59 -0
- data/set-of-emails/maildir/bsd/arf-08.eml +103 -0
- data/set-of-emails/maildir/bsd/arf-09.eml +104 -0
- data/set-of-emails/maildir/bsd/arf-10.eml +56 -0
- data/set-of-emails/maildir/bsd/arf-11.eml +37 -0
- data/set-of-emails/maildir/bsd/arf-12.eml +40 -0
- data/set-of-emails/maildir/bsd/arf-13.eml +76 -0
- data/set-of-emails/maildir/bsd/arf-14.eml +333 -0
- data/set-of-emails/maildir/bsd/arf-15.eml +66 -0
- data/set-of-emails/maildir/bsd/courier-01.eml +79 -0
- data/set-of-emails/maildir/bsd/courier-02.eml +83 -0
- data/set-of-emails/maildir/bsd/courier-03.eml +85 -0
- data/set-of-emails/maildir/bsd/courier-04.eml +87 -0
- data/set-of-emails/maildir/bsd/de-einsundeins-01.eml +38 -0
- data/set-of-emails/maildir/bsd/de-gmx-01.eml +52 -0
- data/set-of-emails/maildir/bsd/de-gmx-02.eml +51 -0
- data/set-of-emails/maildir/bsd/de-gmx-03.eml +56 -0
- data/set-of-emails/maildir/bsd/de-gmx-04.eml +51 -0
- data/set-of-emails/maildir/bsd/domino-01.eml +33 -0
- data/set-of-emails/maildir/bsd/domino-02.eml +83 -0
- data/set-of-emails/maildir/bsd/exchange-01.eml +31 -0
- data/set-of-emails/maildir/bsd/exchange-02.eml +67 -0
- data/set-of-emails/maildir/bsd/exchange-03.eml +52 -0
- data/set-of-emails/maildir/bsd/exchange-04.eml +28 -0
- data/set-of-emails/maildir/bsd/exchange-05.eml +56 -0
- data/set-of-emails/maildir/bsd/exchange-06.eml +151 -0
- data/set-of-emails/maildir/bsd/exim-01.eml +46 -0
- data/set-of-emails/maildir/bsd/exim-02.eml +41 -0
- data/set-of-emails/maildir/bsd/exim-03.eml +42 -0
- data/set-of-emails/maildir/bsd/exim-04.eml +46 -0
- data/set-of-emails/maildir/bsd/exim-05.eml +49 -0
- data/set-of-emails/maildir/bsd/exim-06.eml +44 -0
- data/set-of-emails/maildir/bsd/exim-07.eml +28 -0
- data/set-of-emails/maildir/bsd/exim-08.eml +42 -0
- data/set-of-emails/maildir/bsd/exim-09.eml +169 -0
- data/set-of-emails/maildir/bsd/exim-10.eml +718 -0
- data/set-of-emails/maildir/bsd/exim-11.eml +718 -0
- data/set-of-emails/maildir/bsd/exim-12.eml +75 -0
- data/set-of-emails/maildir/bsd/exim-13.eml +145 -0
- data/set-of-emails/maildir/bsd/exim-14.eml +32 -0
- data/set-of-emails/maildir/bsd/exim-15.eml +49 -0
- data/set-of-emails/maildir/bsd/exim-16.eml +98 -0
- data/set-of-emails/maildir/bsd/exim-17.eml +50 -0
- data/set-of-emails/maildir/bsd/exim-18.eml +96 -0
- data/set-of-emails/maildir/bsd/exim-19.eml +52 -0
- data/set-of-emails/maildir/bsd/exim-20.eml +159 -0
- data/set-of-emails/maildir/bsd/exim-21.eml +150 -0
- data/set-of-emails/maildir/bsd/exim-22.eml +50 -0
- data/set-of-emails/maildir/bsd/exim-23.eml +57 -0
- data/set-of-emails/maildir/bsd/exim-24.eml +107 -0
- data/set-of-emails/maildir/bsd/exim-25.eml +18 -0
- data/set-of-emails/maildir/bsd/exim-26.eml +111 -0
- data/set-of-emails/maildir/bsd/exim-27.eml +120 -0
- data/set-of-emails/maildir/bsd/exim-28.eml +148 -0
- data/set-of-emails/maildir/bsd/google-apps-01.eml +66 -0
- data/set-of-emails/maildir/bsd/imailserver-01.eml +27 -0
- data/set-of-emails/maildir/bsd/imailserver-02.eml +36 -0
- data/set-of-emails/maildir/bsd/imailserver-03.eml +28 -0
- data/set-of-emails/maildir/bsd/imailserver-04.eml +15 -0
- data/set-of-emails/maildir/bsd/imailserver-05.eml +92 -0
- data/set-of-emails/maildir/bsd/imailserver-06.eml +29 -0
- data/set-of-emails/maildir/bsd/interscanmss-01.eml +49 -0
- data/set-of-emails/maildir/bsd/interscanmss-02.eml +259 -0
- data/set-of-emails/maildir/bsd/jp-biglobe-01.eml +43 -0
- data/set-of-emails/maildir/bsd/jp-ezweb-01.eml +36 -0
- data/set-of-emails/maildir/bsd/jp-ezweb-02.eml +65 -0
- data/set-of-emails/maildir/bsd/jp-ezweb-03.eml +35 -0
- data/set-of-emails/maildir/bsd/jp-ezweb-04.eml +38 -0
- data/set-of-emails/maildir/bsd/jp-ezweb-05.eml +38 -0
- data/set-of-emails/maildir/bsd/jp-ezweb-06.eml +33 -0
- data/set-of-emails/maildir/bsd/jp-kddi-01.eml +49 -0
- data/set-of-emails/maildir/bsd/jp-kddi-02.eml +54 -0
- data/set-of-emails/maildir/bsd/jp-kddi-03.eml +54 -0
- data/set-of-emails/maildir/bsd/mailfoundry-01.eml +50 -0
- data/set-of-emails/maildir/bsd/mailfoundry-02.eml +49 -0
- data/set-of-emails/maildir/bsd/mailmarshalsmtp-01.eml +43 -0
- data/set-of-emails/maildir/bsd/mcafee-01.eml +63 -0
- data/set-of-emails/maildir/bsd/mcafee-02.eml +65 -0
- data/set-of-emails/maildir/bsd/mcafee-03.eml +59 -0
- data/set-of-emails/maildir/bsd/messagingserver-01.eml +102 -0
- data/set-of-emails/maildir/bsd/messagingserver-02.eml +72 -0
- data/set-of-emails/maildir/bsd/messagingserver-03.eml +70 -0
- data/set-of-emails/maildir/bsd/messagingserver-04.eml +102 -0
- data/set-of-emails/maildir/bsd/messagingserver-05.eml +98 -0
- data/set-of-emails/maildir/bsd/messagingserver-06.eml +101 -0
- data/set-of-emails/maildir/bsd/messagingserver-07.eml +129 -0
- data/set-of-emails/maildir/bsd/mfilter-01.eml +49 -0
- data/set-of-emails/maildir/bsd/mfilter-02.eml +48 -0
- data/set-of-emails/maildir/bsd/mfilter-03.eml +43 -0
- data/set-of-emails/maildir/bsd/mxlogic-01.eml +47 -0
- data/set-of-emails/maildir/bsd/mxlogic-02.eml +44 -0
- data/set-of-emails/maildir/bsd/mxlogic-03.eml +46 -0
- data/set-of-emails/maildir/bsd/notes-01.eml +42 -0
- data/set-of-emails/maildir/bsd/notes-02.eml +42 -0
- data/set-of-emails/maildir/bsd/notes-03.eml +38 -0
- data/set-of-emails/maildir/bsd/notes-04.eml +181 -0
- data/set-of-emails/maildir/bsd/opensmtpd-01.eml +33 -0
- data/set-of-emails/maildir/bsd/opensmtpd-02.eml +33 -0
- data/set-of-emails/maildir/bsd/opensmtpd-03.eml +36 -0
- data/set-of-emails/maildir/bsd/opensmtpd-04.eml +40 -0
- data/set-of-emails/maildir/bsd/opensmtpd-05.eml +36 -0
- data/set-of-emails/maildir/bsd/postfix-01.eml +60 -0
- data/set-of-emails/maildir/bsd/postfix-02.eml +78 -0
- data/set-of-emails/maildir/bsd/postfix-03.eml +71 -0
- data/set-of-emails/maildir/bsd/postfix-04.eml +89 -0
- data/set-of-emails/maildir/bsd/postfix-05.eml +78 -0
- data/set-of-emails/maildir/bsd/postfix-06.eml +72 -0
- data/set-of-emails/maildir/bsd/postfix-07.eml +74 -0
- data/set-of-emails/maildir/bsd/postfix-08.eml +78 -0
- data/set-of-emails/maildir/bsd/postfix-09.eml +76 -0
- data/set-of-emails/maildir/bsd/postfix-10.eml +73 -0
- data/set-of-emails/maildir/bsd/postfix-11.eml +86 -0
- data/set-of-emails/maildir/bsd/postfix-12.eml +71 -0
- data/set-of-emails/maildir/bsd/postfix-13.eml +81 -0
- data/set-of-emails/maildir/bsd/postfix-14.eml +68 -0
- data/set-of-emails/maildir/bsd/postfix-15.eml +69 -0
- data/set-of-emails/maildir/bsd/postfix-16.eml +73 -0
- data/set-of-emails/maildir/bsd/postfix-17.eml +68 -0
- data/set-of-emails/maildir/bsd/postfix-18.eml +121 -0
- data/set-of-emails/maildir/bsd/postfix-19.eml +105 -0
- data/set-of-emails/maildir/bsd/postfix-20.eml +231 -0
- data/set-of-emails/maildir/bsd/postfix-21.eml +60 -0
- data/set-of-emails/maildir/bsd/qmail-01.eml +40 -0
- data/set-of-emails/maildir/bsd/qmail-02.eml +35 -0
- data/set-of-emails/maildir/bsd/qmail-03.eml +22 -0
- data/set-of-emails/maildir/bsd/qmail-04.eml +31 -0
- data/set-of-emails/maildir/bsd/qmail-05.eml +31 -0
- data/set-of-emails/maildir/bsd/qmail-06.eml +39 -0
- data/set-of-emails/maildir/bsd/qmail-07.eml +22 -0
- data/set-of-emails/maildir/bsd/qmail-08.eml +23 -0
- data/set-of-emails/maildir/bsd/qmail-09.eml +103 -0
- data/set-of-emails/maildir/bsd/rfc3464-01.eml +60 -0
- data/set-of-emails/maildir/bsd/rfc3464-02.eml +43 -0
- data/set-of-emails/maildir/bsd/rfc3464-03.eml +40 -0
- data/set-of-emails/maildir/bsd/rfc3464-04.eml +50 -0
- data/set-of-emails/maildir/bsd/rfc3464-05.eml +63 -0
- data/set-of-emails/maildir/bsd/rfc3464-06.eml +48 -0
- data/set-of-emails/maildir/bsd/rfc3464-07.eml +88 -0
- data/set-of-emails/maildir/bsd/rfc3464-08.eml +70 -0
- data/set-of-emails/maildir/bsd/rfc3464-09.eml +93 -0
- data/set-of-emails/maildir/bsd/rfc3464-10.eml +467 -0
- data/set-of-emails/maildir/bsd/rfc3464-11.eml +1171 -0
- data/set-of-emails/maildir/bsd/rfc3464-12.eml +101 -0
- data/set-of-emails/maildir/bsd/rfc3464-13.eml +131 -0
- data/set-of-emails/maildir/bsd/rfc3464-14.eml +121 -0
- data/set-of-emails/maildir/bsd/rfc3464-15.eml +144 -0
- data/set-of-emails/maildir/bsd/rfc3464-16.eml +36 -0
- data/set-of-emails/maildir/bsd/rfc3464-17.eml +109 -0
- data/set-of-emails/maildir/bsd/rfc3464-18.eml +149 -0
- data/set-of-emails/maildir/bsd/rfc3464-19.eml +65 -0
- data/set-of-emails/maildir/bsd/rfc3464-20.eml +145 -0
- data/set-of-emails/maildir/bsd/rfc3464-21.eml +146 -0
- data/set-of-emails/maildir/bsd/rfc3464-22.eml +105 -0
- data/set-of-emails/maildir/bsd/rfc3464-23.eml +21 -0
- data/set-of-emails/maildir/bsd/rfc3464-24.eml +27 -0
- data/set-of-emails/maildir/bsd/rfc3464-25.eml +33 -0
- data/set-of-emails/maildir/bsd/rfc3464-26.eml +98 -0
- data/set-of-emails/maildir/bsd/rfc3464-27.eml +180 -0
- data/set-of-emails/maildir/bsd/rfc3834-01.eml +37 -0
- data/set-of-emails/maildir/bsd/rfc3834-02.eml +51 -0
- data/set-of-emails/maildir/bsd/rfc3834-03.eml +33 -0
- data/set-of-emails/maildir/bsd/ru-mailru-01.eml +54 -0
- data/set-of-emails/maildir/bsd/ru-mailru-02.eml +54 -0
- data/set-of-emails/maildir/bsd/ru-mailru-03.eml +62 -0
- data/set-of-emails/maildir/bsd/ru-mailru-04.eml +54 -0
- data/set-of-emails/maildir/bsd/ru-yandex-01.eml +102 -0
- data/set-of-emails/maildir/bsd/ru-yandex-02.eml +113 -0
- data/set-of-emails/maildir/bsd/ru-yandex-03.eml +101 -0
- data/set-of-emails/maildir/bsd/sendmail-01.eml +70 -0
- data/set-of-emails/maildir/bsd/sendmail-02.eml +82 -0
- data/set-of-emails/maildir/bsd/sendmail-03.eml +76 -0
- data/set-of-emails/maildir/bsd/sendmail-04.eml +63 -0
- data/set-of-emails/maildir/bsd/sendmail-05.eml +64 -0
- data/set-of-emails/maildir/bsd/sendmail-06.eml +67 -0
- data/set-of-emails/maildir/bsd/sendmail-07.eml +65 -0
- data/set-of-emails/maildir/bsd/sendmail-08.eml +62 -0
- data/set-of-emails/maildir/bsd/sendmail-09.eml +60 -0
- data/set-of-emails/maildir/bsd/sendmail-10.eml +82 -0
- data/set-of-emails/maildir/bsd/sendmail-11.eml +60 -0
- data/set-of-emails/maildir/bsd/sendmail-12.eml +62 -0
- data/set-of-emails/maildir/bsd/sendmail-13.eml +66 -0
- data/set-of-emails/maildir/bsd/sendmail-14.eml +64 -0
- data/set-of-emails/maildir/bsd/sendmail-15.eml +60 -0
- data/set-of-emails/maildir/bsd/sendmail-16.eml +69 -0
- data/set-of-emails/maildir/bsd/sendmail-17.eml +68 -0
- data/set-of-emails/maildir/bsd/sendmail-18.eml +64 -0
- data/set-of-emails/maildir/bsd/sendmail-19.eml +71 -0
- data/set-of-emails/maildir/bsd/sendmail-20.eml +120 -0
- data/set-of-emails/maildir/bsd/sendmail-21.eml +69 -0
- data/set-of-emails/maildir/bsd/sendmail-22.eml +73 -0
- data/set-of-emails/maildir/bsd/sendmail-23.eml +137 -0
- data/set-of-emails/maildir/bsd/sendmail-24.eml +66 -0
- data/set-of-emails/maildir/bsd/sendmail-25.eml +70 -0
- data/set-of-emails/maildir/bsd/sendmail-26.eml +71 -0
- data/set-of-emails/maildir/bsd/sendmail-27.eml +69 -0
- data/set-of-emails/maildir/bsd/sendmail-28.eml +69 -0
- data/set-of-emails/maildir/bsd/sendmail-29.eml +70 -0
- data/set-of-emails/maildir/bsd/sendmail-30.eml +68 -0
- data/set-of-emails/maildir/bsd/sendmail-31.eml +80 -0
- data/set-of-emails/maildir/bsd/sendmail-32.eml +71 -0
- data/set-of-emails/maildir/bsd/sendmail-33.eml +71 -0
- data/set-of-emails/maildir/bsd/sendmail-34.eml +75 -0
- data/set-of-emails/maildir/bsd/sendmail-35.eml +70 -0
- data/set-of-emails/maildir/bsd/sendmail-36.eml +71 -0
- data/set-of-emails/maildir/bsd/sendmail-37.eml +71 -0
- data/set-of-emails/maildir/bsd/surfcontrol-01.eml +79 -0
- data/set-of-emails/maildir/bsd/surfcontrol-02.eml +70 -0
- data/set-of-emails/maildir/bsd/surfcontrol-03.eml +70 -0
- data/set-of-emails/maildir/bsd/uk-messagelabs-01.eml +76 -0
- data/set-of-emails/maildir/bsd/us-amazonses-01.eml +59 -0
- data/set-of-emails/maildir/bsd/us-amazonses-02.eml +177 -0
- data/set-of-emails/maildir/bsd/us-amazonses-03.eml +55 -0
- data/set-of-emails/maildir/bsd/us-amazonses-04.eml +55 -0
- data/set-of-emails/maildir/bsd/us-aol-01.eml +1258 -0
- data/set-of-emails/maildir/bsd/us-aol-02.eml +1257 -0
- data/set-of-emails/maildir/bsd/us-aol-03.eml +1264 -0
- data/set-of-emails/maildir/bsd/us-aol-04.eml +1260 -0
- data/set-of-emails/maildir/bsd/us-bigfoot-01.eml +64 -0
- data/set-of-emails/maildir/bsd/us-facebook-01.eml +40 -0
- data/set-of-emails/maildir/bsd/us-facebook-02.eml +42 -0
- data/set-of-emails/maildir/bsd/us-google-01.eml +70 -0
- data/set-of-emails/maildir/bsd/us-google-02.eml +50 -0
- data/set-of-emails/maildir/bsd/us-google-03.eml +51 -0
- data/set-of-emails/maildir/bsd/us-google-04.eml +82 -0
- data/set-of-emails/maildir/bsd/us-google-05.eml +50 -0
- data/set-of-emails/maildir/bsd/us-google-06.eml +56 -0
- data/set-of-emails/maildir/bsd/us-google-07.eml +42 -0
- data/set-of-emails/maildir/bsd/us-google-08.eml +59 -0
- data/set-of-emails/maildir/bsd/us-google-09.eml +76 -0
- data/set-of-emails/maildir/bsd/us-google-10.eml +69 -0
- data/set-of-emails/maildir/bsd/us-google-11.eml +68 -0
- data/set-of-emails/maildir/bsd/us-google-12.eml +76 -0
- data/set-of-emails/maildir/bsd/us-google-13.eml +79 -0
- data/set-of-emails/maildir/bsd/us-google-14.eml +304 -0
- data/set-of-emails/maildir/bsd/us-outlook-01.eml +72 -0
- data/set-of-emails/maildir/bsd/us-outlook-02.eml +72 -0
- data/set-of-emails/maildir/bsd/us-outlook-03.eml +72 -0
- data/set-of-emails/maildir/bsd/us-outlook-04.eml +79 -0
- data/set-of-emails/maildir/bsd/us-outlook-05.eml +85 -0
- data/set-of-emails/maildir/bsd/us-outlook-06.eml +75 -0
- data/set-of-emails/maildir/bsd/us-outlook-07.eml +70 -0
- data/set-of-emails/maildir/bsd/us-receivingses-01.eml +74 -0
- data/set-of-emails/maildir/bsd/us-receivingses-02.eml +74 -0
- data/set-of-emails/maildir/bsd/us-receivingses-03.eml +74 -0
- data/set-of-emails/maildir/bsd/us-receivingses-04.eml +74 -0
- data/set-of-emails/maildir/bsd/us-receivingses-05.eml +74 -0
- data/set-of-emails/maildir/bsd/us-receivingses-06.eml +74 -0
- data/set-of-emails/maildir/bsd/us-receivingses-07.eml +74 -0
- data/set-of-emails/maildir/bsd/us-sendgrid-01.eml +95 -0
- data/set-of-emails/maildir/bsd/us-sendgrid-02.eml +98 -0
- data/set-of-emails/maildir/bsd/us-sendgrid-03.eml +100 -0
- data/set-of-emails/maildir/bsd/us-verizon-01.eml +31 -0
- data/set-of-emails/maildir/bsd/us-yahoo-01.eml +78 -0
- data/set-of-emails/maildir/bsd/us-yahoo-02.eml +79 -0
- data/set-of-emails/maildir/bsd/us-yahoo-03.eml +93 -0
- data/set-of-emails/maildir/bsd/us-yahoo-04.eml +94 -0
- data/set-of-emails/maildir/bsd/us-yahoo-05.eml +94 -0
- data/set-of-emails/maildir/bsd/us-zoho-01.eml +40 -0
- data/set-of-emails/maildir/bsd/us-zoho-02.eml +38 -0
- data/set-of-emails/maildir/bsd/us-zoho-03.eml +37 -0
- data/set-of-emails/maildir/bsd/us-zoho-04.eml +47 -0
- data/set-of-emails/maildir/bsd/us-zoho-05.eml +37 -0
- data/set-of-emails/maildir/bsd/v5sendmail-01.eml +24 -0
- data/set-of-emails/maildir/bsd/v5sendmail-02.eml +26 -0
- data/set-of-emails/maildir/bsd/v5sendmail-03.eml +29 -0
- data/set-of-emails/maildir/bsd/v5sendmail-04.eml +29 -0
- data/set-of-emails/maildir/bsd/v5sendmail-05.eml +42 -0
- data/set-of-emails/maildir/bsd/v5sendmail-06.eml +28 -0
- data/set-of-emails/maildir/bsd/v5sendmail-07.eml +35 -0
- data/set-of-emails/maildir/bsd/x1-01.eml +61 -0
- data/set-of-emails/maildir/bsd/x1-02.eml +62 -0
- data/set-of-emails/maildir/bsd/x2-01.eml +41 -0
- data/set-of-emails/maildir/bsd/x2-02.eml +46 -0
- data/set-of-emails/maildir/bsd/x2-03.eml +34 -0
- data/set-of-emails/maildir/bsd/x2-04.eml +0 -0
- data/set-of-emails/maildir/bsd/x2-05.eml +98 -0
- data/set-of-emails/maildir/bsd/x3-01.eml +61 -0
- data/set-of-emails/maildir/bsd/x3-02.eml +64 -0
- data/set-of-emails/maildir/bsd/x3-03.eml +59 -0
- data/set-of-emails/maildir/bsd/x3-04.eml +106 -0
- data/set-of-emails/maildir/bsd/x4-01.eml +92 -0
- data/set-of-emails/maildir/bsd/x4-02.eml +112 -0
- data/set-of-emails/maildir/bsd/x4-03.eml +245 -0
- data/set-of-emails/maildir/bsd/x4-04.eml +81 -0
- data/set-of-emails/maildir/bsd/x4-05.eml +121 -0
- data/set-of-emails/maildir/bsd/x4-06.eml +32 -0
- data/set-of-emails/maildir/bsd/x4-07.eml +153 -0
- data/set-of-emails/maildir/bsd/x5-01.eml +155 -0
- data/set-of-emails/maildir/dos/activehunter-01.eml +54 -0
- data/set-of-emails/maildir/dos/apachejames-01.eml +46 -0
- data/set-of-emails/maildir/dos/arf-01.eml +66 -0
- data/set-of-emails/maildir/dos/courier-01.eml +79 -0
- data/set-of-emails/maildir/dos/de-einsundeins-01.eml +38 -0
- data/set-of-emails/maildir/dos/de-gmx-01.eml +52 -0
- data/set-of-emails/maildir/dos/domino-01.eml +33 -0
- data/set-of-emails/maildir/dos/exchange-01.eml +31 -0
- data/set-of-emails/maildir/dos/exim-01.eml +46 -0
- data/set-of-emails/maildir/dos/google-apps-01.eml +66 -0
- data/set-of-emails/maildir/dos/imailserver-01.eml +27 -0
- data/set-of-emails/maildir/dos/interscanmss-01.eml +49 -0
- data/set-of-emails/maildir/dos/jp-biglobe-01.eml +43 -0
- data/set-of-emails/maildir/dos/jp-ezweb-01.eml +36 -0
- data/set-of-emails/maildir/dos/jp-kddi-01.eml +49 -0
- data/set-of-emails/maildir/dos/mailfoundry-01.eml +50 -0
- data/set-of-emails/maildir/dos/mailmarshalsmtp-01.eml +43 -0
- data/set-of-emails/maildir/dos/mcafee-01.eml +63 -0
- data/set-of-emails/maildir/dos/messagingserver-01.eml +102 -0
- data/set-of-emails/maildir/dos/mfilter-01.eml +49 -0
- data/set-of-emails/maildir/dos/mxlogic-01.eml +47 -0
- data/set-of-emails/maildir/dos/notes-01.eml +42 -0
- data/set-of-emails/maildir/dos/opensmtpd-01.eml +33 -0
- data/set-of-emails/maildir/dos/postfix-01.eml +60 -0
- data/set-of-emails/maildir/dos/qmail-01.eml +40 -0
- data/set-of-emails/maildir/dos/rfc3464-01.eml +59 -0
- data/set-of-emails/maildir/dos/rfc3834-01.eml +37 -0
- data/set-of-emails/maildir/dos/ru-mailru-01.eml +54 -0
- data/set-of-emails/maildir/dos/ru-yandex-01.eml +102 -0
- data/set-of-emails/maildir/dos/sendmail-01.eml +69 -0
- data/set-of-emails/maildir/dos/surfcontrol-01.eml +79 -0
- data/set-of-emails/maildir/dos/uk-messagelabs-01.eml +76 -0
- data/set-of-emails/maildir/dos/us-amazonses-01.eml +59 -0
- data/set-of-emails/maildir/dos/us-aol-01.eml +1258 -0
- data/set-of-emails/maildir/dos/us-bigfoot-01.eml +64 -0
- data/set-of-emails/maildir/dos/us-facebook-01.eml +40 -0
- data/set-of-emails/maildir/dos/us-google-01.eml +70 -0
- data/set-of-emails/maildir/dos/us-outlook-01.eml +72 -0
- data/set-of-emails/maildir/dos/us-receivingses-01.eml +74 -0
- data/set-of-emails/maildir/dos/us-sendgrid-01.eml +95 -0
- data/set-of-emails/maildir/dos/us-verizon-01.eml +31 -0
- data/set-of-emails/maildir/dos/us-yahoo-01.eml +78 -0
- data/set-of-emails/maildir/dos/us-zoho-01.eml +40 -0
- data/set-of-emails/maildir/dos/v5sendmail-01.eml +24 -0
- data/set-of-emails/maildir/dos/x1-01.eml +61 -0
- data/set-of-emails/maildir/dos/x2-01.eml +41 -0
- data/set-of-emails/maildir/dos/x3-01.eml +61 -0
- data/set-of-emails/maildir/dos/x4-01.eml +90 -0
- data/set-of-emails/maildir/dos/x5-01.eml +155 -0
- data/set-of-emails/maildir/err/make-test-01.eml +70 -0
- data/set-of-emails/maildir/err/make-test-02.eml +70 -0
- data/set-of-emails/maildir/err/make-test-03.eml +64 -0
- data/set-of-emails/maildir/err/make-test-04.eml +64 -0
- data/set-of-emails/maildir/err/make-test-05.eml +66 -0
- data/set-of-emails/maildir/err/make-test-06.eml +118 -0
- data/set-of-emails/maildir/err/make-test-07.eml +26 -0
- data/set-of-emails/maildir/err/make-test-08.eml +67 -0
- data/set-of-emails/maildir/err/make-test-09.eml +55 -0
- data/set-of-emails/maildir/err/make-test-10.eml +69 -0
- data/set-of-emails/maildir/err/make-test-11.eml +64 -0
- data/set-of-emails/maildir/err/make-test-12.eml +66 -0
- data/set-of-emails/maildir/err/make-test-13.eml +67 -0
- data/set-of-emails/maildir/err/make-test-14.eml +66 -0
- data/set-of-emails/maildir/err/make-test-15.eml +70 -0
- data/set-of-emails/maildir/err/make-test-16.eml +68 -0
- data/set-of-emails/maildir/err/make-test-17.eml +68 -0
- data/set-of-emails/maildir/err/make-test-18.eml +68 -0
- data/set-of-emails/maildir/err/make-test-19.eml +69 -0
- data/set-of-emails/maildir/err/make-test-20.eml +67 -0
- data/set-of-emails/maildir/err/make-test-21.eml +69 -0
- data/set-of-emails/maildir/err/make-test-22.eml +66 -0
- data/set-of-emails/maildir/err/make-test-23.eml +70 -0
- data/set-of-emails/maildir/err/make-test-24.eml +69 -0
- data/set-of-emails/maildir/err/make-test-25.eml +67 -0
- data/set-of-emails/maildir/err/make-test-26.eml +69 -0
- data/set-of-emails/maildir/err/make-test-27.eml +69 -0
- data/set-of-emails/maildir/err/make-test-28.eml +66 -0
- data/set-of-emails/maildir/err/make-test-29.eml +68 -0
- data/set-of-emails/maildir/err/make-test-30.eml +68 -0
- data/set-of-emails/maildir/err/make-test-31.eml +80 -0
- data/set-of-emails/maildir/err/make-test-32.eml +66 -0
- data/set-of-emails/maildir/err/make-test-33.eml +68 -0
- data/set-of-emails/maildir/err/make-test-34.eml +56 -0
- data/set-of-emails/maildir/err/make-test-35.eml +59 -0
- data/set-of-emails/maildir/err/make-test-36.eml +53 -0
- data/set-of-emails/maildir/err/make-test-37.eml +62 -0
- data/set-of-emails/maildir/mac/activehunter-01.eml +1 -2
- data/set-of-emails/maildir/mac/apachejames-01.eml +1 -4
- data/set-of-emails/maildir/mac/arf-01.eml +1 -3
- data/set-of-emails/maildir/mac/courier-01.eml +1 -6
- data/set-of-emails/maildir/mac/de-einsundeins-01.eml +1 -1
- data/set-of-emails/maildir/mac/de-gmx-01.eml +1 -1
- data/set-of-emails/maildir/mac/domino-01.eml +1 -0
- data/set-of-emails/maildir/mac/exchange-01.eml +1 -0
- data/set-of-emails/maildir/mac/exim-01.eml +1 -1
- data/set-of-emails/maildir/mac/google-apps-01.eml +1 -4
- data/set-of-emails/maildir/mac/imailserver-01.eml +1 -0
- data/set-of-emails/maildir/mac/interscanmss-01.eml +1 -2
- data/set-of-emails/maildir/mac/jp-biglobe-01.eml +1 -2
- data/set-of-emails/maildir/mac/jp-ezweb-01.eml +1 -1
- data/set-of-emails/maildir/mac/jp-kddi-01.eml +1 -2
- data/set-of-emails/maildir/mac/mailfoundry-01.eml +1 -2
- data/set-of-emails/maildir/mac/mailmarshalsmtp-01.eml +1 -2
- data/set-of-emails/maildir/mac/mcafee-01.eml +1 -4
- data/set-of-emails/maildir/mac/messagingserver-01.eml +1 -4
- data/set-of-emails/maildir/mac/mfilter-01.eml +1 -3
- data/set-of-emails/maildir/mac/mxlogic-01.eml +1 -1
- data/set-of-emails/maildir/mac/notes-01.eml +1 -2
- data/set-of-emails/maildir/mac/opensmtpd-01.eml +1 -0
- data/set-of-emails/maildir/mac/postfix-01.eml +1 -3
- data/set-of-emails/maildir/mac/qmail-01.eml +1 -1
- data/set-of-emails/maildir/mac/rfc3464-01.eml +1 -4
- data/set-of-emails/maildir/mac/rfc3834-01.eml +1 -0
- data/set-of-emails/maildir/mac/ru-mailru-01.eml +1 -1
- data/set-of-emails/maildir/mac/ru-yandex-01.eml +1 -4
- data/set-of-emails/maildir/mac/sendmail-01.eml +1 -4
- data/set-of-emails/maildir/mac/surfcontrol-01.eml +1 -5
- data/set-of-emails/maildir/mac/uk-messagelabs-01.eml +1 -4
- data/set-of-emails/maildir/mac/us-amazonses-01.eml +1 -4
- data/set-of-emails/maildir/mac/us-aol-01.eml +1 -15
- data/set-of-emails/maildir/mac/us-bigfoot-01.eml +1 -4
- data/set-of-emails/maildir/mac/us-facebook-01.eml +1 -4
- data/set-of-emails/maildir/mac/us-google-01.eml +1 -1
- data/set-of-emails/maildir/mac/us-outlook-01.eml +1 -4
- data/set-of-emails/maildir/mac/us-receivingses-01.eml +1 -4
- data/set-of-emails/maildir/mac/us-sendgrid-01.eml +1 -3
- data/set-of-emails/maildir/mac/us-verizon-01.eml +1 -2
- data/set-of-emails/maildir/mac/us-yahoo-01.eml +1 -1
- data/set-of-emails/maildir/mac/us-zoho-01.eml +1 -2
- data/set-of-emails/maildir/mac/v5sendmail-01.eml +1 -0
- data/set-of-emails/maildir/mac/x1-01.eml +1 -4
- data/set-of-emails/maildir/mac/x2-01.eml +1 -1
- data/set-of-emails/maildir/mac/x3-01.eml +1 -3
- data/set-of-emails/maildir/mac/x4-01.eml +1 -2
- data/set-of-emails/maildir/mac/x5-01.eml +1 -8
- data/set-of-emails/maildir/not/is-not-bounce-01.eml +25 -0
- data/set-of-emails/to-be-debugged-because/reason-is-onhold/onhold-0001.eml +85 -0
- data/set-of-emails/to-be-debugged-because/reason-is-undefined/undefined-0002.eml +27 -0
- data/set-of-emails/to-be-debugged-because/reason-is-undefined/undefined-0003.eml +78 -0
- data/set-of-emails/to-be-debugged-because/sisimai-cannot-parse-yet/cannot-parse-this-email-0002.eml +25 -0
- data/set-of-emails/to-be-debugged-because/something-is-wrong/issue-106-01.eml +79 -0
- data/set-of-emails/to-be-debugged-because/something-is-wrong/issue-106-02.eml +72 -0
- data/set-of-emails/to-be-debugged-because/something-is-wrong/issue-106-03.eml +68 -0
- data/set-of-emails/to-be-debugged-because/something-is-wrong/no-message-id-from-pr-150.eml +75 -0
- data/set-of-emails/to-be-parsed-for-test/README.md +20 -0
- data/sisimai.gemspec +25 -0
- metadata +647 -0
@@ -0,0 +1,307 @@
|
|
1
|
+
module Sisimai
|
2
|
+
module MTA
|
3
|
+
# Sisimai::MTA::Courier parses a bounce email which created by Courier MTA.
|
4
|
+
# Methods in the module are called from only Sisimai::Message.
|
5
|
+
module Courier
|
6
|
+
# Imported from p5-Sisimail/lib/Sisimai/MTA/Courier.pm
|
7
|
+
class << self
|
8
|
+
require 'sisimai/mta'
|
9
|
+
require 'sisimai/rfc5322'
|
10
|
+
|
11
|
+
# http://www.courier-mta.org/courierdsn.html
|
12
|
+
# courier/module.dsn/dsn*.txt
|
13
|
+
Re0 = {
|
14
|
+
:'from' => %r/Courier mail server at /,
|
15
|
+
:'subject' => %r{(?:
|
16
|
+
NOTICE:[ ]mail[ ]delivery[ ]status[.]
|
17
|
+
|WARNING:[ ]delayed[ ]mail[.]
|
18
|
+
)
|
19
|
+
}x,
|
20
|
+
:'message-id' => %r/\A[<]courier[.][0-9A-F]+[.]/,
|
21
|
+
}
|
22
|
+
Re1 = {
|
23
|
+
:begin => %r{(?:
|
24
|
+
DELAYS[ ]IN[ ]DELIVERING[ ]YOUR[ ]MESSAGE
|
25
|
+
|UNDELIVERABLE[ ]MAIL
|
26
|
+
)
|
27
|
+
}x,
|
28
|
+
:rfc822 => %r{\AContent-Type:[ ]*(?:
|
29
|
+
message/rfc822
|
30
|
+
|text/rfc822-headers
|
31
|
+
)\z
|
32
|
+
}x,
|
33
|
+
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
34
|
+
}
|
35
|
+
ReFailure = {
|
36
|
+
# courier/module.esmtp/esmtpclient.c:526| hard_error(del, ctf, "No such domain.");
|
37
|
+
'hostunknown' => %r{
|
38
|
+
\ANo[ ]such[ ]domain[.]\z
|
39
|
+
}x,
|
40
|
+
# courier/module.esmtp/esmtpclient.c:531| hard_error(del, ctf,
|
41
|
+
# courier/module.esmtp/esmtpclient.c:532| "This domain's DNS violates RFC 1035.");
|
42
|
+
'systemerror' => %r{
|
43
|
+
\AThis[ ]domain's[ ]DNS[ ]violates[ ]RFC[ ]1035[.]\z
|
44
|
+
}x,
|
45
|
+
}
|
46
|
+
ReDelayed = {
|
47
|
+
# courier/module.esmtp/esmtpclient.c:535| soft_error(del, ctf, "DNS lookup failed.");
|
48
|
+
'networkerror' => %r{
|
49
|
+
\ADNS[ ]lookup[ ]failed[.]\z
|
50
|
+
},
|
51
|
+
}
|
52
|
+
Indicators = Sisimai::MTA.INDICATORS
|
53
|
+
LongFields = Sisimai::RFC5322.LONGFIELDS
|
54
|
+
RFC822Head = Sisimai::RFC5322.HEADERFIELDS
|
55
|
+
|
56
|
+
def description; return 'Courier MTA'; end
|
57
|
+
def smtpagent; return 'Courier'; end
|
58
|
+
def headerlist; return []; end
|
59
|
+
def pattern; return Re0; end
|
60
|
+
|
61
|
+
# Parse bounce messages from Courier MTA
|
62
|
+
# @param [Hash] mhead Message header of a bounce email
|
63
|
+
# @options mhead [String] from From header
|
64
|
+
# @options mhead [String] date Date header
|
65
|
+
# @options mhead [String] subject Subject header
|
66
|
+
# @options mhead [Array] received Received headers
|
67
|
+
# @options mhead [String] others Other required headers
|
68
|
+
# @param [String] mbody Message body of a bounce email
|
69
|
+
# @return [Hash, Nil] Bounce data list and message/rfc822
|
70
|
+
# part or nil if it failed to parse or
|
71
|
+
# the arguments are missing
|
72
|
+
def scan(mhead, mbody)
|
73
|
+
return nil unless mhead
|
74
|
+
return nil unless mbody
|
75
|
+
|
76
|
+
match = 0
|
77
|
+
match += 1 if mhead['from'] =~ Re0[:from]
|
78
|
+
match += 1 if mhead['subject'] =~ Re0[:subject]
|
79
|
+
if mhead['message-id']
|
80
|
+
# Message-ID: <courier.4D025E3A.00001792@5jo.example.org>
|
81
|
+
match += 1 if mhead['message-id'] =~ Re0[:'message-id']
|
82
|
+
end
|
83
|
+
return nil if match == 0
|
84
|
+
|
85
|
+
dscontents = []; dscontents << Sisimai::MTA.DELIVERYSTATUS
|
86
|
+
hasdivided = mbody.split("\n")
|
87
|
+
havepassed = [''];
|
88
|
+
rfc822next = { 'from' => false, 'to' => false, 'subject' => false }
|
89
|
+
rfc822part = '' # (String) message/rfc822-headers part
|
90
|
+
previousfn = '' # (String) Previous field name
|
91
|
+
readcursor = 0 # (Integer) Points the current cursor position
|
92
|
+
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
93
|
+
commandtxt = '' # (String) SMTP Command name begin with the string '>>>'
|
94
|
+
connvalues = 0 # (Integer) Flag, 1 if all the value of $connheader have been set
|
95
|
+
connheader = {
|
96
|
+
'date' => '', # The value of Arrival-Date header
|
97
|
+
'rhost' => '', # The value of Reporting-MTA header
|
98
|
+
'lhost' => '', # The value of Received-From-MTA header
|
99
|
+
}
|
100
|
+
v = nil
|
101
|
+
|
102
|
+
hasdivided.each do |e|
|
103
|
+
# Save the current line for the next loop
|
104
|
+
havepassed << e; p = havepassed[-2]
|
105
|
+
|
106
|
+
if readcursor == 0
|
107
|
+
# Beginning of the bounce message or delivery status part
|
108
|
+
if e =~ Re1[:begin]
|
109
|
+
readcursor |= Indicators[:'deliverystatus']
|
110
|
+
next
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
if readcursor & Indicators[:'message-rfc822'] == 0
|
115
|
+
# Beginning of the original message part
|
116
|
+
if e =~ Re1[:rfc822]
|
117
|
+
readcursor |= Indicators[:'message-rfc822']
|
118
|
+
next
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
if readcursor & Indicators[:'message-rfc822'] > 0
|
123
|
+
# After "message/rfc822"
|
124
|
+
if cv = e.match(/\A([-0-9A-Za-z]+?)[:][ ]*.+\z/)
|
125
|
+
# Get required headers only
|
126
|
+
lhs = cv[1].downcase
|
127
|
+
previousfn = ''
|
128
|
+
next unless RFC822Head.key?(lhs)
|
129
|
+
|
130
|
+
previousfn = lhs
|
131
|
+
rfc822part += e + "\n"
|
132
|
+
|
133
|
+
elsif e =~ /\A[ \t]+/
|
134
|
+
# Continued line from the previous line
|
135
|
+
next if rfc822next[previousfn]
|
136
|
+
rfc822part += e + "\n" if LongFields.key?(previousfn)
|
137
|
+
|
138
|
+
else
|
139
|
+
# Check the end of headers in rfc822 part
|
140
|
+
next unless LongFields.key?(previousfn)
|
141
|
+
next unless e.empty?
|
142
|
+
rfc822next[previousfn] = true
|
143
|
+
end
|
144
|
+
|
145
|
+
else
|
146
|
+
# Before "message/rfc822"
|
147
|
+
next if readcursor & Indicators[:'deliverystatus'] == 0
|
148
|
+
next if e.empty?
|
149
|
+
|
150
|
+
if connvalues == connheader.keys.size
|
151
|
+
# Final-Recipient: rfc822; kijitora@example.co.jp
|
152
|
+
# Action: failed
|
153
|
+
# Status: 5.0.0
|
154
|
+
# Remote-MTA: dns; mx.example.co.jp [192.0.2.95]
|
155
|
+
# Diagnostic-Code: smtp; 550 5.1.1 <kijitora@example.co.jp>... User Unknown
|
156
|
+
v = dscontents[-1]
|
157
|
+
|
158
|
+
if cv = e.match(/\A[Ff]inal-[Rr]ecipient:[ ]*(?:RFC|rfc)822;[ ]*([^ ]+)\z/)
|
159
|
+
# Final-Recipient: rfc822; kijitora@example.co.jp
|
160
|
+
if v['recipient']
|
161
|
+
# There are multiple recipient addresses in the message body.
|
162
|
+
dscontents << Sisimai::MTA.DELIVERYSTATUS;
|
163
|
+
v = dscontents[-1]
|
164
|
+
end
|
165
|
+
v['recipient'] = cv[1]
|
166
|
+
recipients += 1
|
167
|
+
|
168
|
+
elsif cv = e.match(/\A[Xx]-[Aa]ctual-[Rr]ecipient:[ ]*(?:RFC|rfc)822;[ ]*([^ ]+)\z/)
|
169
|
+
# X-Actual-Recipient: RFC822; kijitora@example.co.jp
|
170
|
+
v['alias'] = cv[1]
|
171
|
+
|
172
|
+
elsif cv = e.match(/\A[Aa]ction:[ ]*(.+)\z/)
|
173
|
+
# Action: failed
|
174
|
+
v['action'] = cv[1].downcase
|
175
|
+
|
176
|
+
elsif cv = e.match(/\A[Ss]tatus:[ ]*(\d[.]\d+[.]\d+)/)
|
177
|
+
# Status: 5.1.1
|
178
|
+
# Status:5.2.0
|
179
|
+
# Status: 5.1.0 (permanent failure)
|
180
|
+
v['status'] = cv[1]
|
181
|
+
|
182
|
+
elsif cv = e.match(/\A[Rr]emote-MTA:[ ]*(?:DNS|dns);[ ]*(.+)\z/)
|
183
|
+
# Remote-MTA: DNS; mx.example.jp
|
184
|
+
v['rhost'] = cv[1].downcase
|
185
|
+
if v['rhost'] =~ / /
|
186
|
+
# Get the first element
|
187
|
+
v['rhost'] = v['rhost'].split(' ').shift
|
188
|
+
end
|
189
|
+
|
190
|
+
elsif cv = e.match(/\A[Ll]ast-[Aa]ttempt-[Dd]ate:[ ]*(.+)\z/)
|
191
|
+
# Last-Attempt-Date: Fri, 14 Feb 2014 12:30:08 -0500
|
192
|
+
v['date'] = cv[1]
|
193
|
+
|
194
|
+
else
|
195
|
+
if cv = e.match(/\A[Dd]iagnostic-[Cc]ode:[ ]*(.+?);[ ]*(.+)\z/)
|
196
|
+
# Diagnostic-Code: SMTP; 550 5.1.1 <userunknown@example.jp>... User Unknown
|
197
|
+
v['spec'] = cv[1].upcase
|
198
|
+
v['diagnosis'] = cv[2]
|
199
|
+
|
200
|
+
elsif p =~ /\A[Dd]iagnostic-[Cc]ode:[ ]*/ && cv = e.match(/\A[ \t]+(.+)\z/)
|
201
|
+
# Continued line of the value of Diagnostic-Code header
|
202
|
+
v['diagnosis'] ||= ''
|
203
|
+
v['diagnosis'] += ' ' + cv[1]
|
204
|
+
havepassed[-1] = 'Diagnostic-Code: ' + e
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
else
|
209
|
+
# This is a delivery status notification from marutamachi.example.org,
|
210
|
+
# running the Courier mail server, version 0.65.2.
|
211
|
+
#
|
212
|
+
# The original message was received on Sat, 11 Dec 2010 12:19:57 +0900
|
213
|
+
# from [127.0.0.1] (c10920.example.com [192.0.2.20])
|
214
|
+
#
|
215
|
+
# ---------------------------------------------------------------------------
|
216
|
+
#
|
217
|
+
# UNDELIVERABLE MAIL
|
218
|
+
#
|
219
|
+
# Your message to the following recipients cannot be delivered:
|
220
|
+
#
|
221
|
+
# <kijitora@example.co.jp>:
|
222
|
+
# mx.example.co.jp [74.207.247.95]:
|
223
|
+
# >>> RCPT TO:<kijitora@example.co.jp>
|
224
|
+
# <<< 550 5.1.1 <kijitora@example.co.jp>... User Unknown
|
225
|
+
#
|
226
|
+
# ---------------------------------------------------------------------------
|
227
|
+
if cv = e.match(/\A[>]{3}[ ]+([A-Z]{4})[ ]?/)
|
228
|
+
# >>> DATA
|
229
|
+
next if commandtxt.size > 0
|
230
|
+
commandtxt = cv[1]
|
231
|
+
|
232
|
+
elsif cv = e.match(/\A[Rr]eporting-MTA:[ ]*(?:DNS|dns);[ ]*(.+)\z/)
|
233
|
+
# Reporting-MTA: dns; mx.example.jp
|
234
|
+
next if connheader['rhost'].size > 0
|
235
|
+
connheader['rhost'] = cv[1].downcase
|
236
|
+
connvalues += 1
|
237
|
+
|
238
|
+
elsif cv = e.match(/\A[Rr]eceived-[Ff]rom-MTA:[ ]*(?:DNS|dns);[ ]*(.+)\z/)
|
239
|
+
# Received-From-MTA: DNS; x1x2x3x4.dhcp.example.ne.jp
|
240
|
+
next if connheader['lhost'].size > 0
|
241
|
+
connheader['lhost'] = cv[1].downcase
|
242
|
+
connvalues += 1
|
243
|
+
|
244
|
+
elsif cv = e.match(/\A[Aa]rrival-[Dd]ate:[ ]*(.+)\z/)
|
245
|
+
# Arrival-Date: Wed, 29 Apr 2009 16:03:18 +0900
|
246
|
+
next if connheader['date'].size > 0
|
247
|
+
connheader['date'] = cv[1]
|
248
|
+
connvalues += 1
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
return nil if recipients == 0
|
255
|
+
require 'sisimai/string'
|
256
|
+
require 'sisimai/smtp/status'
|
257
|
+
|
258
|
+
dscontents.map do |e|
|
259
|
+
# Set default values if each value is empty.
|
260
|
+
connheader.each_key { |a| e[a] ||= connheader[a] || '' }
|
261
|
+
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
|
262
|
+
|
263
|
+
if mhead['received'].size > 0
|
264
|
+
# Get localhost and remote host name from Received header.
|
265
|
+
r0 = mhead['received']
|
266
|
+
['lhost', 'rhost'].each { |a| e[a] ||= '' }
|
267
|
+
e['lhost'] = Sisimai::RFC5322.received(r0[0]).shift if e['lhost'].empty?
|
268
|
+
e['rhost'] = Sisimai::RFC5322.received(r0[-1]).pop if e['rhost'].empty?
|
269
|
+
end
|
270
|
+
|
271
|
+
ReFailure.each_key do |r|
|
272
|
+
# Verify each regular expression of session errors
|
273
|
+
next unless e['diagnosis'] =~ ReFailure[r]
|
274
|
+
e['reason'] = r
|
275
|
+
e['softbounce'] = 0
|
276
|
+
break
|
277
|
+
end
|
278
|
+
|
279
|
+
unless e['reason']
|
280
|
+
ReDelayed.each_key do |r|
|
281
|
+
# Verify each regular expression of session errors
|
282
|
+
next unless e['diagnosis'] =~ ReDelayed[r]
|
283
|
+
e['reason'] = r
|
284
|
+
e['softbounce'] = 1
|
285
|
+
break
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
if !e['status'] || e['status'] =~ /\d[.]0[.]0\z/
|
290
|
+
# Get the status code from the respnse of remote MTA.
|
291
|
+
f = Sisimai::SMTP::Status.find(e['diagnosis'])
|
292
|
+
e['status'] = f if f.size > 0
|
293
|
+
end
|
294
|
+
e['spec'] = '' unless e['spec'] =~ /\A(?:SMTP|X-UNIX)\z/
|
295
|
+
e['agent'] = Sisimai::MTA::Courier.smtpagent
|
296
|
+
e['command'] ||= commandtxt || ''
|
297
|
+
e.each_key { |a| e[a] ||= '' }
|
298
|
+
end
|
299
|
+
|
300
|
+
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
301
|
+
end
|
302
|
+
|
303
|
+
end
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
@@ -0,0 +1,209 @@
|
|
1
|
+
module Sisimai
|
2
|
+
module MTA
|
3
|
+
# Sisimai::MTA::Domino parses a bounce email which created by IBM Domino Server.
|
4
|
+
# Methods in the module are called from only Sisimai::Message.
|
5
|
+
module Domino
|
6
|
+
# Imported from p5-Sisimail/lib/Sisimai/MTA/Domino.pm
|
7
|
+
class << self
|
8
|
+
require 'sisimai/mta'
|
9
|
+
require 'sisimai/rfc5322'
|
10
|
+
|
11
|
+
Re0 = {
|
12
|
+
:subject => %r/\ADELIVERY FAILURE:/,
|
13
|
+
}
|
14
|
+
Re1 = {
|
15
|
+
:begin => %r/\AYour message/,
|
16
|
+
:rfc822 => %r|\AContent-Type: message/delivery-status\z|,
|
17
|
+
:endof => %r/\A__END_OF_EMAIL_MESSAGE__\z/,
|
18
|
+
}
|
19
|
+
ReFailure = {
|
20
|
+
'userunknown' => %r{(?>
|
21
|
+
not[ ]listed[ ]in[ ](?:
|
22
|
+
Domino[ ]Directory
|
23
|
+
|public[ ]Name[ ][&][ ]Address[ ]Book
|
24
|
+
)
|
25
|
+
|Domino[ ]ディレクトリには見つかりません
|
26
|
+
)
|
27
|
+
}x,
|
28
|
+
'filtered' => %r{
|
29
|
+
Cannot[ ]route[ ]mail[ ]to[ ]user
|
30
|
+
}x,
|
31
|
+
'systemerror' => %r{
|
32
|
+
Several[ ]matches[ ]found[ ]in[ ]Domino[ ]Directory
|
33
|
+
}x,
|
34
|
+
}
|
35
|
+
Indicators = Sisimai::MTA.INDICATORS
|
36
|
+
LongFields = Sisimai::RFC5322.LONGFIELDS
|
37
|
+
RFC822Head = Sisimai::RFC5322.HEADERFIELDS
|
38
|
+
|
39
|
+
def description; return 'IBM Domino Server'; end
|
40
|
+
def smtpagent; return 'Domino'; end
|
41
|
+
def headerlist; return []; end
|
42
|
+
def pattern; return Re0; end
|
43
|
+
|
44
|
+
# Parse bounce messages from IBM Domino Server
|
45
|
+
# @param [Hash] mhead Message header of a bounce email
|
46
|
+
# @options mhead [String] from From header
|
47
|
+
# @options mhead [String] date Date header
|
48
|
+
# @options mhead [String] subject Subject header
|
49
|
+
# @options mhead [Array] received Received headers
|
50
|
+
# @options mhead [String] others Other required headers
|
51
|
+
# @param [String] mbody Message body of a bounce email
|
52
|
+
# @return [Hash, Nil] Bounce data list and message/rfc822
|
53
|
+
# part or nil if it failed to parse or
|
54
|
+
# the arguments are missing
|
55
|
+
def scan(mhead, mbody)
|
56
|
+
return nil unless mhead
|
57
|
+
return nil unless mbody
|
58
|
+
return nil unless mhead['subject'] =~ Re0[:subject]
|
59
|
+
|
60
|
+
dscontents = []; dscontents << Sisimai::MTA.DELIVERYSTATUS
|
61
|
+
hasdivided = mbody.split("\n")
|
62
|
+
rfc822next = { 'from' => false, 'to' => false, 'subject' => false }
|
63
|
+
rfc822part = '' # (String) message/rfc822-headers part
|
64
|
+
previousfn = '' # (String) Previous field name
|
65
|
+
readcursor = 0 # (Integer) Points the current cursor position
|
66
|
+
recipients = 0 # (Integer) The number of 'Final-Recipient' header
|
67
|
+
subjecttxt = '' # (String) The value of Subject:
|
68
|
+
v = nil
|
69
|
+
|
70
|
+
require 'sisimai/address'
|
71
|
+
|
72
|
+
hasdivided.each do |e|
|
73
|
+
next if e.empty?
|
74
|
+
|
75
|
+
if readcursor == 0
|
76
|
+
# Beginning of the bounce message or delivery status part
|
77
|
+
if e =~ Re1[:begin]
|
78
|
+
readcursor |= Indicators[:'deliverystatus']
|
79
|
+
next
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
if readcursor & Indicators[:'message-rfc822'] == 0
|
84
|
+
# Beginning of the original message part
|
85
|
+
if e =~ Re1[:rfc822]
|
86
|
+
readcursor |= Indicators[:'message-rfc822']
|
87
|
+
next
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
if readcursor & Indicators[:'message-rfc822'] > 0
|
92
|
+
# After "message/rfc822"
|
93
|
+
if cv = e.match(/\A([-0-9A-Za-z]+?)[:][ ]*.+\z/)
|
94
|
+
# Get required headers only
|
95
|
+
lhs = cv[1].downcase
|
96
|
+
previousfn = ''
|
97
|
+
next unless RFC822Head.key?(lhs)
|
98
|
+
|
99
|
+
previousfn = lhs
|
100
|
+
rfc822part += e + "\n"
|
101
|
+
|
102
|
+
elsif e =~ /\A[ \t]+/
|
103
|
+
# Continued line from the previous line
|
104
|
+
next if rfc822next[previousfn]
|
105
|
+
rfc822part += e + "\n" if LongFields.key?(previousfn)
|
106
|
+
|
107
|
+
else
|
108
|
+
# Check the end of headers in rfc822 part
|
109
|
+
next unless LongFields.key?(previousfn)
|
110
|
+
next unless e.empty?
|
111
|
+
rfc822next[previousfn] = true
|
112
|
+
end
|
113
|
+
|
114
|
+
else
|
115
|
+
# Before "message/rfc822"
|
116
|
+
next if readcursor & Indicators[:'deliverystatus'] == 0
|
117
|
+
|
118
|
+
# Your message
|
119
|
+
#
|
120
|
+
# Subject: Test Bounce
|
121
|
+
#
|
122
|
+
# was not delivered to:
|
123
|
+
#
|
124
|
+
# kijitora@example.net
|
125
|
+
#
|
126
|
+
# because:
|
127
|
+
#
|
128
|
+
# User some.name (kijitora@example.net) not listed in Domino Directory
|
129
|
+
#
|
130
|
+
v = dscontents[-1]
|
131
|
+
|
132
|
+
if e =~ /\Awas not delivered to:\z/
|
133
|
+
# was not delivered to:
|
134
|
+
if v['recipient']
|
135
|
+
# There are multiple recipient addresses in the message body.
|
136
|
+
dscontents << Sisimai::MTA.DELIVERYSTATUS
|
137
|
+
v = dscontents[-1]
|
138
|
+
end
|
139
|
+
v['recipient'] ||= e
|
140
|
+
recipients += 1
|
141
|
+
|
142
|
+
elsif cv = e.match(/\A[ ][ ]([^ ]+[@][^ ]+)\z/)
|
143
|
+
# Continued from the line "was not delivered to:"
|
144
|
+
# kijitora@example.net
|
145
|
+
v['recipient'] = Sisimai::Address.s3s4(cv[1])
|
146
|
+
|
147
|
+
elsif e =~ /\Abecause:\z/
|
148
|
+
# because:
|
149
|
+
v['diagnosis'] = e
|
150
|
+
|
151
|
+
else
|
152
|
+
|
153
|
+
if v['diagnosis'] && v['diagnosis'] == 'because:'
|
154
|
+
# Error message, continued from the line "because:"
|
155
|
+
v['diagnosis'] = e
|
156
|
+
|
157
|
+
elsif cv = e.match(/\A[ ][ ]Subject: (.+)\z/)
|
158
|
+
# Subject: Nyaa
|
159
|
+
subjecttxt = cv[1]
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
return nil if recipients == 0
|
166
|
+
require 'sisimai/string'
|
167
|
+
require 'sisimai/smtp/status'
|
168
|
+
|
169
|
+
dscontents.map do |e|
|
170
|
+
# Set default values if each value is empty.
|
171
|
+
e['agent'] = Sisimai::MTA::Domino.smtpagent
|
172
|
+
|
173
|
+
if mhead['received'].size > 0
|
174
|
+
# Get localhost and remote host name from Received header.
|
175
|
+
r0 = mhead['received']
|
176
|
+
['lhost', 'rhost'].each { |a| e[a] ||= '' }
|
177
|
+
e['lhost'] = Sisimai::RFC5322.received(r0[0]).shift if e['lhost'].empty?
|
178
|
+
e['rhost'] = Sisimai::RFC5322.received(r0[-1]).pop if e['rhost'].empty?
|
179
|
+
end
|
180
|
+
e['diagnosis'] = Sisimai::String.sweep(e['diagnosis'])
|
181
|
+
e['recipient'] = Sisimai::Address.s3s4(e['recipient'])
|
182
|
+
|
183
|
+
ReFailure.each_key do |r|
|
184
|
+
# Check each regular expression of Domino error messages
|
185
|
+
next unless e['diagnosis'] =~ ReFailure[r]
|
186
|
+
e['reason'] = r
|
187
|
+
pseudostatus = Sisimai::SMTP::Status.code(r, false)
|
188
|
+
e['status'] = pseudostatus if pseudostatus.size > 0
|
189
|
+
break
|
190
|
+
end
|
191
|
+
|
192
|
+
e['spec'] = e['reason'] == 'mailererror' ? 'X-UNIX' : 'SMTP'
|
193
|
+
e['action'] = 'failed' if e['status'] =~ /\A[45]/
|
194
|
+
|
195
|
+
unless rfc822part =~ /\bSubject:/
|
196
|
+
# Fallback: Add the value of Subject as a Subject header
|
197
|
+
rfc822part += sprintf("Subject: %s\n", subjecttxt)
|
198
|
+
end
|
199
|
+
e.each_key { |a| e[a] ||= '' }
|
200
|
+
end
|
201
|
+
|
202
|
+
return { 'ds' => dscontents, 'rfc822' => rfc822part }
|
203
|
+
end
|
204
|
+
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|