GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::SMTP::SERVER::RELAY (3)

.ds Aq ’

NAME

Net::SMTP::Server::Relay - A simple relay module for Net::SMTP::Server.

CONTENTS

SYNOPSIS



  use Carp;
  use Net::SMTP::Server;
  use Net::SMTP::Server::Client;
  use Net::SMTP::Server::Relay;

  $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 clients 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, were 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 Net::SMTP::Server::Relay($client->{FROM},
                                             $client->{TO},
                                             $client->{MSG});
  }



DESCRIPTION

The Net::SMTP::Server::Relay module implements simple SMTP relaying for use with the Net::SMTP::Server module. All this module does is to take a given message and iterate through the list of recipients, doing DNS lookups for the associated MX record and delivering the messages. This module makes extensive use of the plethora of other modules already implemented for Perl (specifically the DNS and Net::SMTP modules in this case), and should give but a glimpse of the potential for extending the Net::SMTP::Server’s functionality to provide a full-featured SMTP server, native to Perl.

The above example illustrates the use of the Net::SMTP::Server::Relay modules — you simply have to instantiate the module, passing along the sender, recipients, and message. More formally:



  $relay = new Net::SMTP::Server::Relay($from, @to, $msg);



Where $from is the sender, @to is an array containing the list of recipients, and $msg is the message to relay.

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

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
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 SERVER::RELAY (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.