The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Haineko::SMTPD::Relay::Screen - Just print an email message

DESCRIPTION

Haineko::SMTPD::Relay::Screen is a dummy connection class for printing an email message to Standard error device. This mailer is useful to debug.

SYNOPSIS

    use Haineko::SMTPD::Relay::Screen;
    my $h = { 'Subject' => 'Test', 'To' => 'neko@example.org' };
    my $v = { 
        'mail' => 'kijitora@example.jp',
        'rcpt' => 'neko@example.org',
        'head' => $h,
        'body' => 'Email message',
    };
    my $e = Haineko::SMTPD::Relay::Screen->new( %$v );
    my $s = $e->sendmail;

    print $s;                   # 1 = Always return 1
    print $e->response->error;  # 0 = Always return 0
    print $e->response->dsn;    # D.S.N. is always "undef"

    warn Data::Dumper::Dumper $e->response;
    $VAR1 = bless( {
             'dsn' => undef,
             'error' => 0,
             'code' => '200',
             'host' => undef,
             'port' => undef,
             'rcpt' => 'neko@example.org',
             'message' => [ 'OK' ],
             'command' => 'DATA'
            }, 'Haineko::SMTPD::Response' );

CLASS METHODS

new( %arguments )

new() is a constructor of Haineko::SMTPD::Relay::Screen

    my $e = Haineko::SMTPD::Relay::Screen->new( 
            'attr' => {                     # Args for Email::MIME
                'content_type' => 'text/plain'
            },
            'head' => {                     # Email header
                'Subject' => 'Test',
                'To' => 'neko@example.org',
            },
            'body' => 'Email message',      # Email body
            'mail' => 'kijitora@example.jp',# Envelope sender
            'rcpt' => 'cat@example.org',    # Envelope recipient
    );

INSTANCE METHODS

sendmail

sendmail() will print an email to standard error device.

    my $e = Haineko::SMTPD::Relay::Screen->new( %argvs );
    print $e->sendmail;         # Always 1
    print Dumper $e->response;  # Dumps Haineko::SMTPD::Response object

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.