NAME

Monitoring::Sneck::Checks::smtp - checks a SMTP server

VERSION

Version 0.0.1

SYNOPSIS

smtp|perl:smtp -H mail.example.org
smtp_tls|perl:smtp -H mail.example.org -s -E SIZE -E PIPELINING -w 1 -c 3
submissions|perl:smtp -H mail.example.org -p 465 -S -E AUTH
smtp_banner|perl:smtp -H 192.0.2.25 -e 'ESMTP Postfix'

DESCRIPTION

Connects, reads the greeting, says EHLO, and QUITs, timing it all. A greeting other than 220, such as 554 for refusing, a EHLO not answered with 250, or a extension asked for not being offered, is CRITICAL, as is not being able to connect.

With --starttls, STARTTLS must be offered, and is done, with EHLO said again over TLS. With --ssl, it connects over TLS from the start, as for port 465. The certificate is checked unless --insecure is given. See Monitoring::Sneck::Checks::https_cert with --starttls smtp for when it expires.

OPTIONS

- -H, --hostname :: The host, and the name asked for through SNI, unless it is a IP. Required.

- -p, --port :: The port. Default :: 25, or 465 with --ssl

- -S, --ssl :: Connect over TLS. Can not be used with --starttls.

- -s, --starttls :: STARTTLS must be offered, and is done. Can not be used with --ssl.

- -e, --expect :: Text the greeting must have.

- -E, --extension :: A extension EHLO must offer, such as SIZE, AUTH, or PIPELINING. May be given more than once.

- -n, --helo-name :: The name to give in EHLO. Default :: the host name of this host

- -w, --warning :: Range of seconds for the whole of it.

- -c, --critical :: Range of seconds for the whole of it.

- --insecure :: Do not check the certificate.

- --ca-file :: The CA file to check the certificate against.

METHODS

check

Does the check.

command

Sends a SMTP command and reads the reply.

- socket :: The socket.

- command :: The command, without the line ending.

Returns the reply, as from "reply".

reply

Reads a SMTP reply, all of its lines.

Returns a hash ref of code, 0 if none came, text, the lines without their codes joined by newlines, and extensions, a hash ref of the upper cased first word of each line after the first, for EHLO.