App::MadEye::Plugin::Agent::SMTPTLS - check smtptls.


App-MadEye documentation Contained in the App-MadEye distribution.

Index


Code Index:

NAME

Top

App::MadEye::Plugin::Agent::SMTPTLS - check smtptls.

SCHEMA

Top

    type: map
    mapping:
        target:
            type: seq
            required: yes
            sequence:
                - type: str
        port:
            required: no
            type: int
        timeout:
            required: no
            type: int

AUTHOR

Top

Tokuhiro Matsuno

SEE ALSO

Top

App::MadEye, Net::SMTP::TLS


App-MadEye documentation Contained in the App-MadEye distribution.

package App::MadEye::Plugin::Agent::SMTPTLS;
use strict;
use warnings;
use App::MadEye::Plugin::Agent::Base;

use Net::SMTP::TLS;

sub is_dead {
    my ( $self, $host ) = @_;

    my $conf    = $self->config->{config};
    my $port    = $conf->{port} || 25;
    my $timeout = $conf->{timeout} || 3;

    eval {
        my $smtptls = Net::SMTP::TLS->new(
            $host,
            Hello   => $host,
            Port    => $port,
            NoTLS   => 1,
            Timeout => $timeout,
        );
    };
    if ($@) {
        return "dead: $@";
    }
    else {
        return;    # alive!
    }
}

1;
__END__