NAME
Sisimai::Message - Convert email text to data structure.
SYNOPSIS
use Sisimai::Mail;
use Sisimai::Message;
my $mailbox = Sisimai::Mail->new('/var/mail/root');
while( my $r = $mailbox->read ) {
my $p = Sisimai::Message->new( 'data' => $r );
}
DESCRIPTION
Sisimai::Message convert email text to data structure. It resolve email text into an UNIX From line, the header part of the mail, delivery status, and RFC822 header part.
CLASS METHODS
new( Hash reference )
new()
is a constructor of Sisimai::Message
my $mailtxt = 'Entire email text';
my $message = Sisimai::Message->new( 'data' => $mailtxt );
INSTANCE METHODS
(from)
from()
returns the UNIX From line of the email.
print $message->from;
header()
header()
returns the header part of the email.
print $message->header->{'subject'}; # Returned mail: see transcript for details
ds()
ds()
returns an array reference which include contents of delivery status.
for my $e ( @{ $message->ds } ) {
print $e->{'status'}; # 5.1.1
print $e->{'recipient'};# neko@example.jp
}
rfc822()
rfc822()
returns a hash reference which include the header part of the original message.
print $message->rfc822->{'from'}; # cat@example.com
print $message->rfc822->{'to'}; # neko@example.jp
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.