azuma, kuniyuki > Haineko-0.2.16 > Haineko::SMTPD::Milter

Download:
Haineko-0.2.16.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Haineko::SMTPD::Milter - Haineko milter base class

DESCRIPTION ^

Check or rewrite contents like a milter program at each phase of SMTP session. Each method is called from /submit for example: MAIL -> mail(), RCPT -> rcpt().

SYNOPSIS ^

    use Haineko::SMTPD::Milter;
    Haineko::SMTPD::Milter->libs( [ '/path/to/lib1', '/path/to/lib2' ] );
    my $x = Haineko::SMTPD::Milter->import( [ 'Neko' ] );   # Load Haineko::SMTPD::Milter::Neko
    warn Dumper $x;                                         # [ Haineko::SMTPD::Milter::Neko ]

    my $y = Haineko::SMTPD::Milter->import( [ '+My::Encrypt' ]);    # Load My::Encrypt module
    warn Dumper $y;                                                 # [ 'My::Encrypt' ]

CLASS METHODS ^

libs( [ ... ] )

Add paths in the argument into @INC for finding modules of milter. It may be useful when modules used as a milter are not installed in directories of @INC.

import( [ ... ] )

Load modules in the argument as a module for milter. If a module name begin with + such as +My::Encrypt, My::Encrypt module will be loaded. A Module which doesn't begin with + such as Neko, ``Haineko::SMTPD::Milter::Neko'' will be loaded.

IMPLEMENT MILTER METHODS (Overridden by Haineko::SMTPD::Milter::*) ^

Each method is called from /submit at each phase of SMTP session. If you want to reject the smtp connection, set required values into Haineko::SMTPD::Response object and return 0 or undef as a return value of each method. However you want to only rewrite contents or passed your contents filter, return 1 or true as a return value.

conn( Haineko::SMTPD::Response, REMOTE_HOST, REMOTE_ADDR )

conn() method is for checking a client hostname and client IP address.

Arguments

Haineko::SMTPD::::Response object

If your milter program rejects a message, set 1 by ->error(1), set error message by ->message( [ 'Error message' ]), and override SMTP status code by ->code(), Default SMTP status codes is 421 in this method.

REMOTE_HOST

The host name of the message sender, as picked from HTTP REMOTE_HOST variable.

REMOTE_ADDR

The host address, as picked from HTTP REMOTE_ADDR variable.

ehlo( Haineko::SMTPD::Response, HELO_HOST )

ehlo() method is for checking a hostname passed as an argument of EHLO.

Arguments

Haineko::SMTPD::Response object

If your milter program rejects a message, set 1 by ->error(1), set error message by ->message( [ 'Error message' ]), and override SMTP status code by ->code(), override D.S.N value by ->dsn(). Default SMTP status codes is 521 in this method.

HELO_HOST

Value defined in ehlo field in HTTP POST JSON data, which should be the domain name of the sending host or IP address enclosed square brackets.

mail( Haineko::SMTPD::Response, ENVELOPE_SENDER )

mail() method is for checking an envelope sender address.

Arguments

Haineko::SMTPD::Response object

If your milter program rejects a message, set 1 by ->error(1), set error message by ->message( [ 'Error message' ]), and override SMTP status code by ->code(), override D.S.N value by ->dsn(). Default SMTP status codes is 501, dsn is 5.1.8 in this method.

ENVELOPE_SENDER

Value defined in "mail" field in HTTP POST JSON data, which should be the valid email address.

rcpt( Haineko::SMTPD::Response, ENVELOPE_RECIPIENT )

rcpt() method is for checking envelope recipient address.

Arguments

Haineko::SMTPD::Response object

If your milter program rejects a message, set 1 by ->error(1), set error message by ->message( [ 'Error message' ]), and override SMTP status code by ->code(), override D.S.N value by ->dsn(). Default SMTP status codes is 553, dsn is 5.7.1 in this method.

ENVELOPE_RECIPIENTS

Values defined in rcpt field in HTTP POST JSON data, which should be the valid email address.

head( Haineko::SMTPD::Response, { EMAIL_HEADER } )

head() method is for checking email header. Email header is password as an hash reference.

Arguments

Haineko::SMTPD::Response object

If your milter program rejects a message, set 1 by ->error(1), set error message by ->message( [ 'Error message' ]), and override SMTP status code by ->code(), override D.S.N value by ->dsn(). Default SMTP status codes is 554, dsn is 5.7.1 in this method.

EMAIL_HEADER

Values defined in "header" field in HTTP POST JSON data.

body( Haineko::SMTPD::Response, \EMAIL_BODY )

body() method is for checking email body. Email body is password as an scalar reference.

Arguments

Haineko::SMTPD::Response object

If your milter program rejects a message, set 1 by ->error(1), set error message by ->message( [ 'Error message' ]), and override SMTP status code by ->code(), override D.S.N value by ->dsn(). Default SMTP status codes is 554, dsn is 5.6.0 in this method.

EMAIL_BODY

Value defined in "body" field in HTTP POST JSON data.

SEE ALSO ^

https://www.milter.org/developers/api/

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.

syntax highlighting: