Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

net::smtp::server::client(3pm) [debian man page]

Server::Client(3pm)					User Contributed Perl Documentation				       Server::Client(3pm)

NAME
Net::SMTP::Server::Client - Client session handling for Net::SMTP::Server. 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: $! "); 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: $! "); # 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 Net::SMTP::Server::Relay($client->{FROM}, $client->{TO}, $client->{MSG}); } DESCRIPTION
The Net::SMTP::Server::Client module implements all the session handling required for a Net::SMTP::Server::Client connection. The above example demonstrates how to use Net::SMTP::Server::Client with Net::SMTP::Server to handle SMTP connections. $client = new Net::SMTP::Server::Client($conn) Net::SMTP::Server::Client accepts one argument that must be a handle to a connection that will be used for communication. Once you have a new client session, simply call: $client->process This processes an SMTP transaction. THIS MAY APPEAR TO HANG -- ESPECIALLY IF THERE IS A LARGE AMOUNT OF DATA BEING SENT. Once this method returns, the server will have processed an entire SMTP transaction, and is ready to continue. Once $client->process returns, various fields have been filled in. Those are: $client->{TO} -- This is an array containing the intended recipients for this message. There may be multiple recipients for any given message. $client->{FROM} -- This is the sender of the given message. $client->{MSG} -- The actual message data. :) 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::Relay perl v5.10.1 1999-12-28 Server::Client(3pm)

Check Out this Related Man Page

Net::SMTP::TLS(3pm)					User Contributed Perl Documentation				       Net::SMTP::TLS(3pm)

NAME
Net::SMTP::TLS - An SMTP client supporting TLS and AUTH VERSION
Version 0.12 SYNOPSIS
use Net::SMTP::TLS; my $mailer = new Net::SMTP::TLS( 'your.mail.host', Hello => 'some.host.name', Port => 25, #redundant User => 'emailguy', Password=> 's3cr3t'); $mailer->mail('emailguy@your.mail.host'); $mailer->to('someonecool@somewhere.else'); $mailer->data; $mailer->datasend("Sent thru TLS!"); $mailer->dataend; $mailer->quit; DESCRIPTION
Net::SMTP::TLS is a TLS and AUTH capable SMTP client which offers an interface that users will find familiar from Net::SMTP. Net::SMTP::TLS implements a subset of the methods provided by that module, but certainly not (yet) a complete mirror image of that API. The methods supported by Net::SMTP::TLS are used in the above example. Though self explanatory for the most part, please see the perldoc for Net::SMTP if you are unclear. The differences in the methods provided are as follows: The mail method does not take the options list taken by Net::SMTP The to method also does not take options, and is the only method available to set the recipient (unlike the many synonyms provided by Net::SMTP). The constructor takes a limited number of Net::SMTP's parameters. The constructor for Net::SMTP::TLS takes the following (in addition to the hostname of the mail server, which must be the first parameter and is not explicitly named): NoTLS - In the unlikely event that you need to use this class to perform non-TLS SMTP (you ought to be using Net::SMTP itself for that...), this will turn off TLS when supplied with a true value. This will most often cause an error related to authentication when used on a server that requires TLS Hello - hostname used in the EHLO command Port - port to connect to the SMTP service (defaults to 25) Timeout - Timeout for inital socket connection (defaults to 5, passed directly to IO::Socket::INET) User - username for SMTP AUTH Password - password for SMTP AUTH TLS and AUTHentication During construction of an Net::SMTP::TLS instance, the full login process will occur. This involves first sending EHLO to the server, then initiating a TLS session through STARTTLS. Once this is complete, the module will attempt to login using the credentials supplied by the constructor, if such credentials have been supplied. The AUTH method will depend on the features returned by the server after the EHLO command. Based on that, CRAM-MD5 will be used if available, followed by LOGIN, followed by PLAIN. Please note that LOGIN is the only method of authentication that has been tested. CRAM-MD5 and PLAIN login functionality was taken directly from the script mentioned in the acknowledgements section, however, I have not tested them personally. ERROR HANDLING
This module will croak in the event of an SMTP error. Should you wish to handle this gracefully in your application, you may wrap your mail transmission in an eval {} block and check $@ afterward. ACKNOWLEDGEMENTS
This code was blatantly plagiarized from Michal Ludvig's smtp-client.pl script. See <http://www.logix.cz/michal/devel/smtp> for his excellent work. AUTHOR
Alexander Christian Westholm, awestholm at verizon dawt net Improvements courtesy of Tomek Zielinski perl v5.10.0 2006-01-17 Net::SMTP::TLS(3pm)
Man Page