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

NAME

What::MTA - Find out about running MTA

SYNOPSIS

  $what = What->new( 
             Host => my.domain.org, 
             Port => 25, 
          );  

  $what->mta;
  $what->mta_version;
  $what->mta_banner;
  

DESCRIPTION

What::MTA is a part of What package. It provides basic information about running MTA: name, version and banner that MTA prints out upon connection to it. It is not meant to be used directly, but via its interface, class What. MTA's supported are: Exim, Postfix (version only on localhost), Sendmail, Courier (name only), XMail, MaswMail.

The What::MTA class is a subclass of Net::Cmd and IO::Socket::INET.

CONSTRUCTOR

new ( OPTIONS )

This is the constructor for a new What object.

OPTIONS are passed in a hash like fashion, using key and value pairs. Possible options are:

    Host - is the name, or address, of the remote host to which a connection to a running service is required to. It may be a single scalar, as defined for the PeerAddr option in IO::Socket::INET. Host is optional, default value is localhost.

    LocalAddr and LocalPort - These parameters are passed directly to IO::Socket to allow binding the socket to a local port.

    Timeout - Maximum time, in seconds, to wait for a response from the server (default: 120)

    Port - Port to which to connect to (default: 25)

    Debug - Enable debugging information

Example:

    $what = What->new( 
                       Host    => 'my.mail.domain'
                       Timeout => 30,
                       Debug   => 1,
                     );

    $what = What->new(
                       Host => '10.10.10.1',
                       Port => 25,
                     );

METHODS

mta()

Returns the name of the MTA running.

mta_version()

Returns the version of the MTA running.

mta_banner()

Returns the banner message which the server replied with when the initial connection was made.

EXAMPLES OF MTA BANNERS

Exim
  localhost ESMTP Exim 4.60 Mon, 20 Feb 2006 22:38:53 +0000
Postfix
  localhost ESMTP Postfix (Debian/GNU)
Sendmail
  galeb.somedomain.org ESMTP Sendmail 8.13.5/8.13.5/Debian-3; Mon, 20
  Feb 2006 22:41:04 GMT; (No UCE/UBE) logging access from:
  localhost(OK)-localhost [127.0.0.1]
XMail
  <1140475332.2874633136@mast> [XMail 1.22 ESMTP Server] service ready;
  Mon, 20 Feb 2006 22:42:12 -0000
MasqMail
  mast MasqMail 0.2.21 ESMTP

DIAGNOSTICS

Can not connect to the serice host/port specified
  Couldn't create What::MTA object with
  PeerAddr=localhost,
  PeerPort=26,
  Proto=tcp,
  Timeout=120 at lib/What.pm line 68

DEPENDENCIES

Class::Std depends on the following modules:

BUGS

Please report any bugs or feature requests to bug-what@rt.cpan.org, or through the web interface at http://rt.cpan.org.

ACKNOWLEDGEMENTS

Lot of code taken from Net::Cmd, without which this class probably wouldn't have been written.

AUTHOR

Toni Prug <toni@irational.org>

COPYRIGHT

Copyright (c) 2006. Toni Prug. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

See http://www.gnu.org/licenses/gpl.html