.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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 .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" 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::Data 3pm" .TH Sisimai::Data 3pm "2023-06-11" "perl v5.36.0" "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::Data \- Parsed data object .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 7 \& use Sisimai::Data; \& my $data = Sisimai::Data\->make(\*(Aqdata\*(Aq => object); \& for my $e ( @$data ) { \& print $e\->reason; # userunknown, mailboxfull, and so on. \& print $e\->recipient\->address; # (Sisimai::Address) envelope recipient address \& print $e\->bonced\->ymd # (Sisimai::Time) Date of bounce \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Sisimai::Data generate parsed data from Sisimai::Message object. .SH "CLASS METHODS" .IX Header "CLASS METHODS" .ie n .SS """\f(CBmake(Hash)\fP""" .el .SS "\f(CW\fP\f(CBmake(Hash)\fP\f(CW\fP" .IX Subsection "make(Hash)" \&\f(CW\*(C`make\*(C'\fR generate parsed data and returns an array reference which are including Sisimai::Data objects. .PP .Vb 10 \& my $mail = Sisimai::Mail\->new(\*(Aq/var/mail/root\*(Aq); \& while( my $r = $mail\->read ) { \& my $mesg = Sisimai::Message\->new(\*(Aqdata\*(Aq => $r); \& my $data = Sisimai::Data\->make(\*(Aqdata\*(Aq => $mesg); \& for my $e ( @$data ) { \& print $e\->reason; # userunknown, mailboxfull, and so on. \& print $e\->recipient\->address; # (Sisimai::Address) envelope recipient address \& print $e\->timestamp\->ymd # (Sisimai::Time) Date of the email bounce \& } \& } .Ve .PP If you want to get bounce records which reason is \*(L"delivered\*(R", set \*(L"delivered\*(R" option to \fBmake()\fR method like the following: .PP .Vb 1 \& my $data = Sisimai::Data\->make(\*(Aqdata\*(Aq => $mesg, \*(Aqdelivered\*(Aq => 1); .Ve .PP Beginning from v4.19.0, `hook` argument is available to callback user defined method like the following codes: .PP .Vb 3 \& my $call = sub { \& my $argv = shift; \& my $fish = { \*(Aqx\-mailer\*(Aq => \*(Aq\*(Aq }; \& \& if( $argv\->{\*(Aqmessage\*(Aq} =~ /^X\-Mailer:\es*(.+)$/m ) { \& $fish\->{\*(Aqx\-mailer\*(Aq} = $1; \& } \& \& return $fish; \& }; \& my $mesg = Sisimai::Message\->new(\*(Aqdata\*(Aq => $mailtxt, \*(Aqhook\*(Aq => $call); \& my $data = Sisimai::Data\->make(\*(Aqdata\*(Aq => $mesg); \& for my $e ( @$data ) { \& print $e\->catch\->{\*(Aqx\-mailer\*(Aq}; # Apple Mail (2.1283) \& } .Ve .SH "INSTANCE METHODS" .IX Header "INSTANCE METHODS" .ie n .SS """\f(CBdamn()\fP""" .el .SS "\f(CW\fP\f(CBdamn()\fP\f(CW\fP" .IX Subsection "damn()" \&\f(CW\*(C`damn\*(C'\fR convert the object to a hash reference. .PP .Vb 3 \& my $hash = $self\->damn; \& print $hash\->{\*(Aqrecipient\*(Aq}; # user@example.jp \& print $hash\->{\*(Aqtimestamp\*(Aq}; # 1393940000 .Ve .SH "PROPERTIES" .IX Header "PROPERTIES" Sisimai::Data have the following properties: .ie n .SS """action"" (\fIString\fP)" .el .SS "\f(CWaction\fP (\fIString\fP)" .IX Subsection "action (String)" \&\f(CW\*(C`action\*(C'\fR is the value of Action: field in a bounce email message such as \&\f(CW\*(C`failed\*(C'\fR or \f(CW\*(C`delayed\*(C'\fR. .PP .Vb 1 \& Action: failed .Ve .ie n .SS """addresser"" (\fISisimai::Address)\fP" .el .SS "\f(CWaddresser\fP (\fISisimai::Address)\fP" .IX Subsection "addresser (Sisimai::Address)" \&\f(CW\*(C`addressser\*(C'\fR is Sisimai::Address object generated from the sender address. When Sisimai::Data object is dumped as \s-1JSON,\s0 this value converted to an email address. Sisimai::Address object have the following accessors: .IP "\- \fBuser()\fR \- the local part of the address" 4 .IX Item "- user() - the local part of the address" .PD 0 .IP "\- \fBhost()\fR \- the domain part of the address" 4 .IX Item "- host() - the domain part of the address" .IP "\- \fBaddress()\fR \- email address" 4 .IX Item "- address() - email address" .IP "\- \fBverp()\fR \- variable envelope return path" 4 .IX Item "- verp() - variable envelope return path" .IP "\- \fBalias()\fR \- alias of the address" 4 .IX Item "- alias() - alias of the address" .PD .PP .Vb 1 \& From: "Kijitora Cat" .Ve .ie n .SS """alias"" (\fIString\fP)" .el .SS "\f(CWalias\fP (\fIString\fP)" .IX Subsection "alias (String)" \&\f(CW\*(C`alias\*(C'\fR is an alias address of the recipient. When the Original-Recipient: field or \f(CW\*(C`expanded from "address"\*(C'\fR string did not exist in a bounce message, this value is empty. .PP .Vb 1 \& Original\-Recipient: rfc822;kijitora@example.org \& \& "|IFS=\*(Aq \*(Aq && exec /usr/local/bin/procmail \-f\- || exit 75 #kijitora" \& (expanded from: ) .Ve .ie n .SS """deliverystatus"" (\fIString\fP)" .el .SS "\f(CWdeliverystatus\fP (\fIString\fP)" .IX Subsection "deliverystatus (String)" \&\f(CW\*(C`deliverystatus\*(C'\fR is the value of Status: field in a bounce message. When the message has no Status: field, Sisimai set pseudo value like 5.0.9XX to this value. The range of values only \f(CW\*(C`4.x.x\*(C'\fR or \f(CW\*(C`5.x.x\*(C'\fR. .PP .Vb 1 \& Status: 5.0.0 (permanent failure) .Ve .ie n .SS """destination"" (\fIString\fP)" .el .SS "\f(CWdestination\fP (\fIString\fP)" .IX Subsection "destination (String)" \&\f(CW\*(C`destination\*(C'\fR is the domain part of the recipient address. This value is the same as the return value from \fBhost()\fR method of \f(CW\*(C`recipient\*(C'\fR accessor. .ie n .SS """diagnosticcode"" (\fIString\fP)" .el .SS "\f(CWdiagnosticcode\fP (\fIString\fP)" .IX Subsection "diagnosticcode (String)" \&\f(CW\*(C`diagnosticcode\*(C'\fR is an error message picked from Diagnostic-Code: field or message body in a bounce message. This value and the value of \f(CW\*(C`diagnostictype\*(C'\fR, \&\f(CW\*(C`action\*(C'\fR, \f(CW\*(C`deliverystatus\*(C'\fR, \f(CW\*(C`replycode\*(C'\fR, and \f(CW\*(C`smtpcommand\*(C'\fR will be referred by Sisimai::Reason to decide the bounce reason. .PP .Vb 1 \& Diagnostic\-Code: SMTP; 554 5.4.6 Too many hops .Ve .ie n .SS """diagnostictype"" (""String"")" .el .SS "\f(CWdiagnostictype\fP (\f(CWString\fP)" .IX Subsection "diagnostictype (String)" \&\f(CW\*(C`diagnostictype\*(C'\fR is a type like \f(CW\*(C`SMTP\*(C'\fR or \f(CW\*(C`X\-Unix\*(C'\fR picked from Diagnostic-Code: field in a bounce message. When there is no Diagnostic-Code: field in the bounce message, this value will be empty. .PP .Vb 1 \& Diagnostic\-Code: X\-Unix; 255 .Ve .ie n .SS """feedbacktype"" (\fIString\fP)" .el .SS "\f(CWfeedbacktype\fP (\fIString\fP)" .IX Subsection "feedbacktype (String)" \&\f(CW\*(C`feedbacktype\*(C'\fR is the value of Feedback-Type: field like \f(CW\*(C`abuse\*(C'\fR, \f(CW\*(C`fraud\*(C'\fR, \&\f(CW\*(C`opt\-out\*(C'\fR in a bounce message. When the message is not \s-1ARF\s0 format or the value of \f(CW\*(C`reason\*(C'\fR is not \f(CW\*(C`feedback\*(C'\fR, this value will be empty. .PP .Vb 1 \& Content\-Type: message/feedback\-report \& \& Feedback\-Type: abuse \& User\-Agent: SMP\-FBL .Ve .ie n .SS """lhost"" (\fIString\fP)" .el .SS "\f(CWlhost\fP (\fIString\fP)" .IX Subsection "lhost (String)" \&\f(CW\*(C`lhost\*(C'\fR is a local \s-1MTA\s0 name to be used as a gateway for sending email message or the value of Reporting-MTA field in a bounce message. When there is no Reporting-MTA field in the bounce message, Sisimai try to get the value from Received header. .PP .Vb 1 \& Reporting\-MTA: dns; mx4.smtp.example.co.jp .Ve .ie n .SS """listid"" (\fIString\fP)" .el .SS "\f(CWlistid\fP (\fIString\fP)" .IX Subsection "listid (String)" \&\f(CW\*(C`listid\*(C'\fR is the value of List-Id header of the original message. When there is no List-Id field in the original message or the bounce message did not include the original message, this value will be empty. .PP .Vb 1 \& List\-Id: Mailman mailing list management users .Ve .ie n .SS """messageid"" (\fIString\fP)" .el .SS "\f(CWmessageid\fP (\fIString\fP)" .IX Subsection "messageid (String)" \&\f(CW\*(C`messageid\*(C'\fR is the value of Message-Id header of the original message. When the original message did not include Message-Id: header or the bounce message did not include the original message, this value will be empty. .PP .Vb 1 \& Message\-Id: <201310160515.r9G5FZh9018575@smtpgw.example.jp> .Ve .ie n .SS """origin"" (\fIPath to the original email file\fP)" .el .SS "\f(CWorigin\fP (\fIPath to the original email file\fP)" .IX Subsection "origin (Path to the original email file)" \&\f(CW\*(C`origin\*(C'\fR is the path to the original email file of the parsed results. When the original email data were input from \s-1STDIN,\s0 the value is \f(CW\*(C`, were input from a variable, the value is \f(CW\*(C`. This accessor method has been implemented at v4.25.6. .ie n .SS """recipient"" (\fISisimai::Address)\fP" .el .SS "\f(CWrecipient\fP (\fISisimai::Address)\fP" .IX Subsection "recipient (Sisimai::Address)" \&\f(CW\*(C`recipient\*(C'\fR is Sisimai::Address object generated from the recipient address. When Sisimai::Data object is dumped as \s-1JSON,\s0 this value converted to an email address. Sisimai::Address object have the following accessors: .IP "\- \fBuser()\fR \- the local part of the address" 4 .IX Item "- user() - the local part of the address" .PD 0 .IP "\- \fBhost()\fR \- the domain part of the address" 4 .IX Item "- host() - the domain part of the address" .IP "\- \fBaddress()\fR \- email address" 4 .IX Item "- address() - email address" .IP "\- \fBverp()\fR \- variable envelope return path" 4 .IX Item "- verp() - variable envelope return path" .IP "\- \fBalias()\fR \- alias of the address" 4 .IX Item "- alias() - alias of the address" .PD .PP .Vb 2 \& Final\-Recipient: RFC822; shironeko@example.ne.jp \& X\-Failed\-Recipients: kijitora@example.ed.jp .Ve .ie n .SS """reason"" (\fIString\fP)" .el .SS "\f(CWreason\fP (\fIString\fP)" .IX Subsection "reason (String)" \&\f(CW\*(C`reason\*(C'\fR is the value of bounce reason Sisimai detected. When this value is \&\f(CW\*(C`undefined\*(C'\fR or \f(CW\*(C`onhold\*(C'\fR, it means that Sisimai could not decide the reason. All the reasons Sisismai can detect are available at Sisimai::Reason or web site . .ie n .SS """replycode"" (\fIInteger\fP)" .el .SS "\f(CWreplycode\fP (\fIInteger\fP)" .IX Subsection "replycode (Integer)" \&\f(CW\*(C`replycode\*(C'\fR is the value of \s-1SMTP\s0 reply code picked from the error message or the value of Diagnostic-Code: field in a bounce message. The range of values is only 4xx or 5xx. .PP .Vb 3 \& \-\-\-\-\- The following addresses had permanent fatal errors \-\-\-\-\- \& \& (reason: 550 5.1.1 ... User Unknown) .Ve .ie n .SS """rhost"" (\fIString\fP)" .el .SS "\f(CWrhost\fP (\fIString\fP)" .IX Subsection "rhost (String)" \&\f(CW\*(C`rhost\*(C'\fR is a remote \s-1MTA\s0 name which has rejected the message you sent or the value of Remote-MTA: field in a bounce message. When there is no Remote-MTA field in the bounce message, Sisimai try to get the value from Received header. .PP .Vb 1 \& Remote\-MTA: DNS; g5.example.net .Ve .ie n .SS """senderdomain"" (\fIString\fP)" .el .SS "\f(CWsenderdomain\fP (\fIString\fP)" .IX Subsection "senderdomain (String)" \&\f(CW\*(C`senderdomain\*(C'\fR is the domain part of the sender address. This value is the same as the return value from \fBhost()\fR method of addresser accessor. .ie n .SS """smtpagent"" (\fIString\fP)" .el .SS "\f(CWsmtpagent\fP (\fIString\fP)" .IX Subsection "smtpagent (String)" \&\f(CW\*(C`smtpagent\*(C'\fR is a module name to be used for detecting bounce reason. For example, when the value is \f(CW\*(C`Sendmail\*(C'\fR, Sisimai used Sisimai::Lhost::Sendmail to get the recipient address and other delivery status information from a bounce message. .ie n .SS """smtpcommand"" (\fIString\fP)" .el .SS "\f(CWsmtpcommand\fP (\fIString\fP)" .IX Subsection "smtpcommand (String)" \&\f(CW\*(C`smtpcommand\*(C'\fR is a \s-1SMTP\s0 command name picked from the error message or the value of Diagnostic-Code: field in a bounce message. When there is no \s-1SMTP\s0 command in the bounce message, this value will be empty. The list of values is \f(CW\*(C`HELO\*(C'\fR, \&\f(CW\*(C`EHLO\*(C'\fR, \f(CW\*(C`MAIL\*(C'\fR, \f(CW\*(C`RCPT\*(C'\fR, and \f(CW\*(C`DATA\*(C'\fR. .PP .Vb 2 \& : host mx1.example.go.jp[192.0.2.127] said: 550 5.1.6 recipient \& no longer on server: kijitora@example.go.jp (in reply to RCPT TO command) .Ve .ie n .SS """softbounce"" (\fIInteger\fP)" .el .SS "\f(CWsoftbounce\fP (\fIInteger\fP)" .IX Subsection "softbounce (Integer)" The value of \f(CW\*(C`softbounce\*(C'\fR indicates whether the reason of the bounce is soft bounce or hard bounce. This accessor has added in Sisimai 4.1.28. The range of the values are the followings: .IP "1 = Soft bounce" 4 .IX Item "1 = Soft bounce" .PD 0 .IP "0 = Hard bounce" 4 .IX Item "0 = Hard bounce" .IP "\-1 = Sisimai could not decide" 4 .IX Item "-1 = Sisimai could not decide" .PD .ie n .SS """subject"" (\fIString\fP)" .el .SS "\f(CWsubject\fP (\fIString\fP)" .IX Subsection "subject (String)" \&\f(CW\*(C`subject\*(C'\fR is the value of Subject header of the original message. When the original message which is included in a bounce email contains no Subject header (removed by remote \s-1MTA\s0), this value will be empty. If the value of Subject header of the original message contain any multibyte character (non-ASCII character), such as \s-1MIME\s0 encoded Japanese or German and so on, the value of subject in parsed data is encoded with \s-1UTF\-8\s0 again. .ie n .SS """token"" (\fIString\fP)" .el .SS "\f(CWtoken\fP (\fIString\fP)" .IX Subsection "token (String)" \&\f(CW\*(C`token\*(C'\fR is an identifier of each email-bounce. The token string is created from the sender email address (addresser) and the recipient email address (recipient) and the machine time of the date in a bounce message as an \s-1MD5\s0 hash value. The token value is generated at \f(CW\*(C`token()\*(C'\fR method of Sisimai::String class. .PP If you want to get the same token string at command line, try to run the following command: .PP .Vb 2 \& % printf "\ex02%s\ex1e%s\ex1e%d\ex03" sender@example.jp recipient@example.org \`date \*(Aq+%s\*(Aq\` | md5 \& 714d72dfd972242ad04f8053267e7365 .Ve .ie n .SS """timestamp"" (\fISisimai::Time\fP)" .el .SS "\f(CWtimestamp\fP (\fISisimai::Time\fP)" .IX Subsection "timestamp (Sisimai::Time)" \&\f(CW\*(C`timestamp\*(C'\fR is the date which email has bounced as a Sisima::Time (Child class of Time::Piece) object. When Sisimai::Data object is dumped as \s-1JSON,\s0 this value will be converted to an \s-1UNIX\s0 machine time (32 bits integer). .PP .Vb 1 \& Arrival\-Date: Thu, 29 Apr 2009 23:45:33 +0900 .Ve .ie n .SS """timezomeoffset"" (\fIString\fP)" .el .SS "\f(CWtimezomeoffset\fP (\fIString\fP)" .IX Subsection "timezomeoffset (String)" \&\f(CW\*(C`timezoneoffset\*(C'\fR is a time zone offset of a bounce email which its email has bounced. The format of this value is String like \f(CW+0900\fR, \f(CW\*(C`\-0200\*(C'\fR. If Sisimai has failed to get a value of time zone offset, this value will be set as \f(CW+0000\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" .SH "AUTHOR" .IX Header "AUTHOR" azumakuniyuki .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2014\-2020,2022 azumakuniyuki, All rights reserved. .SH "LICENSE" .IX Header "LICENSE" This software is distributed under The \s-1BSD\s0 2\-Clause License.