← Documentation Index

NAME

Mailmunge::Test::SMTPForward - Perform an SMTP callback to see if another SMTP server would accept a recipient.

ABSTRACT

This class performs a mini SMTP session on a back-end SMTP server to see if that server would accept a recipient. It uses $ctx->connecting_name as the HELO argument and $ctx->sender as the MAIL From: argument.

Mailmunge::Test::SMTPForward is a subclass of Mailmunge::Test.

PREREQUISITES

This class requires IO::Socket::SSL version 1.994 or greater. Some Linux distros such as CentOS 7 ship with an older version of IO::Socket::SSL; on those distros, you will need to install a newer version of IO::Socket::SSL from CPAN.

SYNOPSIS

package MyFilter;
use Mailmunge::Test::SMTPForward;

sub filter_recipient {
    my ($self, $ctx) = @_;
    my $forwarder = Mailmunge::Test::SMTPForward->new($self);
    my $resp = $forwarder->check_against_smtp_server($ctx,
               $ctx->recipients->[0],
               'backend.example.com');
    return $resp unless $resp->is_success();
    # ... rest of filter_recipient
}

CLASS METHOD

Mailmunge::Test::SMTPForward->new($filter)

Constructs a new Mailmunge::Test::SMTPForward object and stores a copy of $filter in it.

INSTANCE METHODS

check_against_smtp_server($ctx, $recipient, $server [, $port]);

Run a mini-SMTP session against $server on port $port (default is port 25) to see if it would accept the recipient $recipient.

The return value is a Mailmunge::Response object whose value reflects the response of the back-end SMTP server.

log_smtp($who, $line)

This method does nothing, but is available to be overridden in a derived class. It is called for each line in the SMTP conversation. For lines sent from the client to the server, $who is set to C and for lines received from the server, $who is set to S. The line itself is in $line, including any trailing "\r\n" characters.

AUTHOR

Dianne Skoll <dianne@skollsoft.com>

LICENSE

This code is licensed under the terms of the GNU General Public License, version 2.

Copyright © 2024 Skoll Software Consulting