Mailmunge::Test::SMTPForward − Perform an SMTP callback to see if another SMTP server would accept a recipient.
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".
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.
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
}
Constructs a new Mailmunge::Test::SMTPForward object and stores a copy of $filter in it.
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.
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.
Dianne Skoll <[email protected]>
This code is licensed under the terms of the GNU General Public License, version 2.