.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Sisimai 3pm" .TH Sisimai 3pm "2018-06-23" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Sisimai \- Mail Analyzing Interface for bounce mails. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Sisimai; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Sisimai is the system formerly known as \f(CW\*(C`bounceHammer\*(C'\fR 4, is a Perl module for analyzing bounce mails and generate structured data in a \s-1JSON\s0 format (\s-1YAML\s0 is also available if \*(L"\s-1YAML\*(R"\s0 module is installed on your system) from parsed bounce messages. \f(CW\*(C`Sisimai\*(C'\fR is a coined word: Sisi (the number 4 is pronounced \*(L"Si\*(R" in Japanese) and \s-1MAI \s0(acronym of \*(L"Mail Analyzing Interface\*(R"). .SH "BASIC USAGE" .IX Header "BASIC USAGE" .ie n .SS """\f(CBmake(\*(Aq/path/to/mbox\*(Aq)\fP""" .el .SS "\f(CW\fP\f(CBmake(\*(Aq/path/to/mbox\*(Aq)\fP\f(CW\fP" .IX Subsection "make(/path/to/mbox)" \&\f(CW\*(C`make\*(C'\fR method provides feature for getting parsed data from bounced email messages like following. .PP .Vb 2 \& use Sisimai; \& my $v = Sisimai\->make(\*(Aq/path/to/mbox\*(Aq); # or Path to Maildir/ \& \& if( defined $v ) { \& for my $e ( @$v ) { \& print ref $e; # Sisimai::Data \& print ref $e\->recipient; # Sisimai::Address \& print ref $e\->timestamp; # Sisimai::Time \& \& print $e\->addresser\->address; # shironeko@example.org # From \& print $e\->recipient\->address; # kijitora@example.jp # To \& print $e\->recipient\->host; # example.jp \& print $e\->deliverystatus; # 5.1.1 \& print $e\->replycode; # 550 \& print $e\->reason; # userunknown \& \& my $h = $e\->damn; # Convert to HASH reference \& my $j = $e\->dump(\*(Aqjson\*(Aq); # Convert to JSON string \& my $y = $e\->dump(\*(Aqyaml\*(Aq); # Convert to YAML string \& } \& \& # Dump entire list as a JSON \& use JSON \*(Aq\-convert_blessed_universally\*(Aq; \& my $json = JSON\->new\->allow_blessed\->convert_blessed; \& \& printf "%s\en", $json\->encode($v); \& } .Ve .PP If you want to get bounce records which reason is \*(L"delivered\*(R", set \*(L"delivered\*(R" option to \fImake()\fR method like the following: .PP .Vb 1 \& my $v = Sisimai\->make(\*(Aq/path/to/mbox\*(Aq, \*(Aqdelivered\*(Aq => 1); .Ve .ie n .SS """\f(CBdump(\*(Aq/path/to/mbox\*(Aq)\fP""" .el .SS "\f(CW\fP\f(CBdump(\*(Aq/path/to/mbox\*(Aq)\fP\f(CW\fP" .IX Subsection "dump(/path/to/mbox)" \&\f(CW\*(C`dump\*(C'\fR method provides feature to get parsed data from bounced email as \s-1JSON.\s0 .PP .Vb 3 \& use Sisimai; \& my $v = Sisimai\->dump(\*(Aq/path/to/mbox\*(Aq); # or Path to Maildir \& print $v; # JSON string .Ve .SH "OTHER WAYS TO PARSE" .IX Header "OTHER WAYS TO PARSE" .SS "Read email data from \s-1STDIN\s0" .IX Subsection "Read email data from STDIN" If you want to pass email data from \s-1STDIN,\s0 specify \fB\s-1STDIN\s0\fR at the first argument of \fIdump()\fR and \fImake()\fR method like following command: .PP .Vb 1 \& % cat ./path/to/bounce.eml | perl \-MSisimai \-lE \*(Aqprint Sisimai\->dump(STDIN)\*(Aq .Ve .SS "Callback Feature" .IX Subsection "Callback Feature" Beginning from v4.19.0, `hook` argument is available to callback user defined method like the following codes: .PP .Vb 7 \& my $cmethod = sub { \& my $argv = shift; \& my $data = { \& \*(Aqqueue\-id\*(Aq => \*(Aq\*(Aq, \& \*(Aqx\-mailer\*(Aq => \*(Aq\*(Aq, \& \*(Aqprecedence\*(Aq => \*(Aq\*(Aq, \& }; \& \& # Header part of the bounced mail \& for my $e ( \*(Aqx\-mailer\*(Aq, \*(Aqprecedence\*(Aq ) { \& next unless exists $argv\->{\*(Aqheaders\*(Aq}\->{ $e }; \& $data\->{ $e } = $argv\->{\*(Aqheaders\*(Aq}\->{ $e }; \& } \& \& # Message body of the bounced email \& if( $argv\->{\*(Aqmessage\*(Aq} =~ /^X\-Postfix\-Queue\-ID:\es*(.+)$/m ) { \& $data\->{\*(Aqqueue\-id\*(Aq} = $1; \& } \& \& return $data; \& }; \& \& my $message = Sisimai::Message\->new( \& \*(Aqdata\*(Aq => $mailtxt, \& \*(Aqhook\*(Aq => $cmethod, \& \*(Aqfield\*(Aq => [\*(AqX\-Mailer\*(Aq, \*(AqPrecedence\*(Aq] \& ); \& print $message\->catch\->{\*(Aqx\-mailer\*(Aq}; # Apple Mail (2.1283) \& print $message\->catch\->{\*(Aqqueue\-id\*(Aq}; # 2DAEB222022E \& print $message\->catch\->{\*(Aqprecedence\*(Aq}; # bulk .Ve .SH "OTHER METHODS" .IX Header "OTHER METHODS" .ie n .SS """\f(CBengine()\fP""" .el .SS "\f(CW\fP\f(CBengine()\fP\f(CW\fP" .IX Subsection "engine()" \&\f(CW\*(C`engine\*(C'\fR method provides table including parser engine list and it's description. .PP .Vb 6 \& use Sisimai; \& my $v = Sisimai\->engine(); \& for my $e ( keys %$v ) { \& print $e; # Sisimai::MTA::Sendmail \& print $v\->{ $e }; # V8Sendmail: /usr/sbin/sendmail \& } .Ve .ie n .SS """\f(CBreason()\fP""" .el .SS "\f(CW\fP\f(CBreason()\fP\f(CW\fP" .IX Subsection "reason()" \&\f(CW\*(C`reason\*(C'\fR method provides table including all the reasons Sisimai can detect .PP .Vb 6 \& use Sisimai; \& my $v = Sisimai\->reason(); \& for my $e ( keys %$v ) { \& print $e; # Blocked \& print $v\->{ $e }; # \*(AqEmail rejected due to client IP address or a hostname\*(Aq \& } .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" .IP "Sisimai::Mail \- Mailbox or Maildir object" 4 .IX Item "Sisimai::Mail - Mailbox or Maildir object" .PD 0 .IP "Sisimai::Data \- Parsed data object" 4 .IX Item "Sisimai::Data - Parsed data object" .IP " \- Sisimai X A successor to bounceHammer, Library to parse error mails" 4 .IX Item " - Sisimai X A successor to bounceHammer, Library to parse error mails" .IP " \- \s-1RFC3463:\s0 Enhanced Mail System Status Codes" 4 .IX Item " - RFC3463: Enhanced Mail System Status Codes" .IP " \- \s-1RFC3464:\s0 An Extensible Message Format for Delivery Status Notifications" 4 .IX Item " - RFC3464: An Extensible Message Format for Delivery Status Notifications" .IP " \- \s-1RFC5321:\s0 Simple Mail Transfer Protocol" 4 .IX Item " - RFC5321: Simple Mail Transfer Protocol" .IP " \- \s-1RFC5322:\s0 Internet Message Format" 4 .IX Item " - RFC5322: Internet Message Format" .PD .SH "REPOSITORY" .IX Header "REPOSITORY" \- Sisimai on GitHub .SH "WEB SITE" .IX Header "WEB SITE" \- A successor to bounceHammer, Library to parse error mails. .PP \- Ruby version of Sisimai .SH "AUTHOR" .IX Header "AUTHOR" azumakuniyuki .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2014\-2018 azumakuniyuki, All rights reserved. .SH "LICENSE" .IX Header "LICENSE" This software is distributed under The \s-1BSD\s0 2\-Clause License.