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

NAME

Net::SMTP::Verify - verify SMTP recipient addresses

VERSION

version 1.03

SYNOPSIS

  use Net::SMTP::Verify;

  my $v = Net::SMTP::Verify->new;
  my $resultset = $v->check(
    100000, # size
    'karl@senderdomain.de', # sender
    'rcpt1@rcptdomain.de', # 1 or more recipients...
    'rcpt2@rcptdomain.de', 
    'rcpt3@rcptdomain.de',
  );

  # check overall status
  $resultset->is_all_success;

  # check a single result
  $resultset->rcpt('rcpt1@rcptdomain.de')->is_success;
  $resultset->rcpt('rcpt1@rcptdomain.de')->smtp_code;
  $resultset->rcpt('rcpt1@rcptdomain.de')->smtp_message;
  $resultset->rcpt('rcpt1@rcptdomain.de')->has_starttls;
  $resultset->rcpt('rcpt1@rcptdomain.de')->has_tlsa;

  # more ways to retrieve results by status...
  $resultset->successfull_rcpts;
  $resultset->error_rcpts;
  $resultset->temp_error_rcpts;
  $resultset->perm_error_rcpts;

DESCRIPTION

This class implements checks for verifying SMTP addresses.

It implements the following checks:

check addresses with SMTP MAIL FROM and RCPT TO commands

Check if the MX would accept mail for test addresses.

check of message size

If the mail exchanger (MX) supports the SIZE extension and a size is given the module will pass the message size with the MAIL FROM command.

This will check if the message would exceed message size limits or recipients quotas on the target MX.

check if MX could handle TLS connections

It will check if the STARTTLS extension required to enstablish encrypted TLS connections is supported by the target MX.

check if TLSA record is available

The module could check if a TLSA record has been published for the target MX server.

If such a record has been published the target MX SSL certificate could be verified with DANE.

ATTRIBUTES

host (default: undef)

Query this smtp server instead of the MX records.

port (default: 25)

Use a different port.

helo_name (default: hostname() )

Use a helo_name other than the hostname of the system.

timeout (default: 30)

Use this timeout for the SMTP connection.

resolver (default: system resolver)

Use a custom Net::DNS::Resolver object.

The default is:

  Net::DNS::Resolver->new(
    dnssec => 1,
    adflag => 1,
  );

The dnssec and adflag is required for the TLSA check.

tlsa (default: 0)

Set to 1 to activate TLSA lookup.

openpgpkey (default: 0)

Set to 1 to activate OPENPGPKEY lookup.

logging_callback (default: sub {})

Set a callback to retrieve log messages.

debug (default: 0)

If set to 1 it will set a logging_callback method to output logs to STDERR.

METHODS

resolve( $domain )

Tries to resolve a MX to an hostname.

It will choose the first record with the highest priority listed as MX.

When a host is MX for multiple domains it will try to reuse the same host for checks.

check_tlsa( $host, $port )

Check if a TLSA record is available.

check( $size, $sender, $rcpt1, $rcpts...)

Performs check and returns a Net::SMTP::Verify::ResultSet.

AUTHOR

Markus Benning <ich@markusbenning.de>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Markus Benning <ich@markusbenning.de>.

This is free software, licensed under:

  The GNU General Public License, Version 2, June 1991