The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Sisimai::Data - Parsed data object

SYNOPSIS

    use Sisimai::Data;
    my $data = Sisimai::Data->make( 'data' => <Sisimai::Message> 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           # (Time::Piece) Date of bounce
    }

DESCRIPTION

Sisimai::Data generate parsed data from Sisimai::Message object.

CLASS METHODS

make( Hash )

make generate parsed data and returns an array reference which are including Sisimai::Data objects.

    my $mail = Sisimai::Mail->new('/var/mail/root');
    while( my $r = $mail->read ) {
        my $mesg = Sisimai::Message->new( 'data' => $r );
        my $data = Sisimai::Data->make( 'data' => $mesg );
        for my $e ( @$data ) {
            print $e->reason;               # userunknown, mailboxfull, and so on.
            print $e->recipient->address;   # (Sisimai::Address) envelope recipient address
            print $e->date->ymd             # (Time::Piece) Date of the email bounce
        }
    }

INSTANCE METHODS

damn()

damn convert the object to a hash reference.

    my $hash = $self->damn;
    print $hash->{'recipient'}; # user@example.jp
    print $hash->{'date'};      # 1393940000

PROPERTIES

Sisimai::Data have the following properties:

date(Time::Piece)

The value of Date: header of the original message or the bounce message.

token(String)

token is a MD5 string generated from the sender address(addresser) and the recipient address.

lhost(String)

Local host name of the email bounce.

rhost(String)

Remote MTA name of the email bounce.

alias(String)

Expanded address of the recipient address.

listid(String)

The value of List-Id header of the original message. If the original message have no such header, this value will be set "".

reason(String)

The reason name of email bounce. The list of all reasons are available at perldoc Sisimai::Reason.

subject(String)

The value of Subject header of the original message encoded in UTF-8.

provider(String)

Provider name of the recipient address. See perldoc Sisimai::Group

category(category)

Cateogry name of the recipient address such as pc, webmail, and phone. See perldoc Sisimai::Group.

addresser(Sisimai::Address)

Sender address of the original message. See perldoc Sisimai::Address.

recipienet(Sisimai::Address)

Recipient address of the original message. See perldoc Sisimai::Address.

messageid(String)

The value of Message-Id header of the original message. When the header does not exist in the message, this value will be set "".

smtpagent(String)

MTA or MSP module name which is used to get bounce reason such as Sendmail, US::Google, and so on. See perldoc Sisimai::MTA or perldoc Sisimai::MSP.

smtpcommand(String)

The last SMTP command name of the session email bounce has occurred.

destination(String)

the domain part of the c<recipient>.

senderdomain(String)

the domain part of the c<addresser>.

feedbacktype(String)

The value of Feedback-Type header of ARF: Abuse Reporting Formatted message.

diagnosticcode(String)

The value of Diagnostic-Code header or error message string in the bounced email.

diagnostictype(String)

SMTP or X-Unix.

deliverystatus(String)

The value of Status header or pseudo D.S.N. value generated from bounce reason or error message string and so on.

timezoneoffset(Integer)

Time zone offset value(seconds).

AUTHOR

azumakuniyuki

COPYRIGHT

Copyright (C) 2014 azumakuniyuki <perl.org@azumakuniyuki.org>, All Rights Reserved.

LICENSE

This software is distributed under The BSD 2-Clause License.