NAME

Haineko::SMTPD::Response - SMTP Response class

DESCRIPTION

SMTP Response class contain SMTP status code, D.S.N. value, response messages, and SMTP command.

SYNOPSIS

use Haineko::SMTPD::Response;
my $e = Haineko::SMTPD::Response->r( 'ehlo', 'invalid-domain' );

print $e->dsn;      # 5.0.0
print $e->code;     # 500

warn Dumper $e->message;
$VAR1 = [
    'Invalid domain name'
];

my $v = { 'command' => 'RCPT', message => [ '550 5.1.1 User unknown' ] };
my $f = Haineko::SMTPD::Response->p( %$v );

print $e->dsn;      # 5.1.1
print $e->code;     # 550

warn Dumper $e->message;
$VAR1 = [
    '550 5.1.1 User unknown'
];

CLASS METHODS

new( %arguments )

new() is a constructor of Haineko::SMTPD::Response

r( SMTP Command, Error type )

r() creates an Haineko::SMTPD::Response object from specified SMTP command and error type.

p( %arguments )

p() creates an Haineko::SMTPD::Response object from SMTP response message.

my $v = { 'command' => 'MAIL', message => [ '552 5.2.2 Mailbox full' ] };
my $f = Haineko::SMTPD::Response->p( %$v );

print $e->dsn;      # 5.2.2
print $e->code;     # 552

warn Dumper $e->message;
$VAR1 = [
    '552 5.2.2 Mailbox full'
];

INSTANCE METHODS

mesg

mesg() add messages to the instance->message

my $f = Haineko::SMTPD::Response->new();
my $v = [ 'new message1', 'new message2' ];
$f->m( $v );

damn

damn() returns instance data as a hash reference

my $v = { 'command' => 'DATA', message => [ '551 5.7.1 Refused' ] };
my $f = Haineko::SMTPD::Response->p( %$v );

print Data::Dumper::Dumper $e->damn;
$VAR1 = {
    'dsn' => '5.7.1',
    'error' => 1,
    'host' => '127.0.0.1',
    'code' => '551',
    'message' => [
        '551 5.7.1 Refused'
    ],
    'command' => 'DATA'
}

REPOSITORY

https://github.com/azumakuniyuki/Haineko

AUTHOR

azumakuniyuki <perl.org [at] azumakuniyuki.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.