Mailmun...Forward(3)

πŸ“¦ version 3.20, in alpine 3.24

πŸ’– NAME πŸ’–

okay so welcome to the User Contributed Perl Documentation corner, bestie β€” this is Mailmunge::Test::SMTPForward(3), and its whole thing is: Perform an SMTP callback to see if another SMTP server would accept a recipient. that's the assignment, and it's iconic. πŸ’…


πŸ¦‹ ABSTRACT πŸ¦‹

so the vibe is: this class runs 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.

also Mailmunge::Test::SMTPForward is a subclass of Mailmunge::Test β€” family tree is giving inheritance realness. πŸ’œ


✨ 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.

so like, check your SSL situation before you come crying to me, bestie. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

here's the use-case in all its code-block glory β€” copy it exactly, no freestyling:

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. that's it β€” constructor slay, copy secured, object born. πŸ‘‘


🌸 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. so yes, you get a response object back, and it's reporting what the back-end SMTP server said. no cap. πŸ“¬

log_smtp($who, $line)

This method does nothing β€” literally a no-op era β€” but it 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. base version is a no-op, but derived classes can override it and get every single line of the SMTP convo. 🫢


πŸ‘‘ AUTHOR πŸ‘‘

Dianne Skoll <dianne@skollsoft.com> β€” author icon, periodt. πŸ’–


πŸ“œ LICENSE πŸ“œ

This code is licensed under the terms of the GNU General Public License, version 2. slay, but make it legal. βš–οΈβœ¨


signed, sealed, delivered by perl v5.42.2 on 2025-10-05, filed under Mailmun...Forward(3) πŸ’Œβœ¨

πŸ“¦ where this page comes from