NAME
    Mail::SpamAssassin::SMTP::SmartHost - A simple smarthost module for
    Net::SMTP::Server.

SYNOPSIS
      use Carp;
      use Net::SMTP::Server;
      use Net::SMTP::Server::Client;
      use Mail::SpamAssassin::SMTP::SmartHost;

      $smarthost="localhost:10026";

      $server = new Net::SMTP::Server('localhost', 25) ||
        croak("Unable to handle client connection: $!\n");

      while($conn = $server->accept()) {
        # We can perform all sorts of checks here for spammers, ACLs,
        # and other useful stuff to check on a connection.

        # Handle the client's connection and spawn off a new parser.
        # This can/should be a fork() or a new thread,
        # but for simplicity...
        my $client = new Net::SMTP::Server::Client($conn) ||
            croak("Unable to handle client connection: $!\n");

        # Process the client.  This command will block until
        # the connecting client completes the SMTP transaction.
        $client->process || next;
    
        # In this simple server, we're just relaying everything
        # to a server.  If a real server were implemented, you
        # could save email to a file, or perform various other
        # actions on it here.
        my $relay = new Mail::SpamAssassin::SMTP::SmartHost($client->{FROM},
                                                     $client->{TO},
                                                     $client->{MSG},
                                                     $smarthost);
      }

DESCRIPTION
    The Mail::SpamAssassin::SMTP::SmartHost module implements simple SMTP
    client connection for use with the Net::SMTP::Server module. All this
    module does is to take a given message and deliver it into another SMTP
    server, using it as a "smarthost", making it useful for reinjecting
    filtered content back into an SMTP server via an unfiltered port.

    This code started life as the Net::SMTP::Server::Relay module which
    comes standard with the Net::SMTP::Server package. After some
    appropriate modifications, it is now useful to connect to an arbitrary
    SMTP server.

    The above example illustrates the use of the
    Mail::SpamAssassin::SMTP::SmartHost module -- you simply have to
    instantiate the module, passing along the sender, recipients, message,
    and next-hop mailserver. More formally:

      $relay = new Mail::SpamAssassin::SMTP::SmartHost($from, @to, $msg, $smarthost);

    Where $from is the sender, @to is an array containing the list of
    recipients, $msg is the message to relay, and $smarthost is the SMTP
    server to which you wish to connect including port in host:port format.

AUTHOR AND COPYRIGHT
    Orignial code Net::SMTP::Server / SMTP::Server is Copyright(C) 1999,
    MacGyver (aka Habeeb J. Dihu) <macgyver@tos.net>. ALL RIGHTS RESERVED.

    Modifications to Net::SMTP::Server::Relay Ian R. Justman
    <ianj@esper.net>

    You may distribute this package under the terms of either the GNU
    General Public License or the Artistic License, as specified in the Perl
    README file.

SEE ALSO
    Net::SMTP::Server::Server, Net::SMTP::Server::Client,
    Net::SMTP::Server::Relay

