.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Server::Client 3pm" .TH Server::Client 3pm "2022-06-30" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::SMTP::Server::Client \- Client session handling for Net::SMTP::Server. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& use Carp; \& use Net::SMTP::Server; \& use Net::SMTP::Server::Client; \& use Net::SMTP::Server::Relay; \& \& $server = new Net::SMTP::Server(\*(Aqlocalhost\*(Aq, 25) || \& croak("Unable to handle client connection: $!\en"); \& \& 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\*(Aqs 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: $!\en"); \& \& # Process the client. This command will block until \& # the connecting client completes the SMTP transaction. \& $client\->process || next; \& \& # In this simple server, we\*(Aqre 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}); \& } .Ve .SH "DESCRIPTION" .IX Header "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 \s-1SMTP\s0 connections. .PP \&\f(CW$client\fR = new Net::SMTP::Server::Client($conn) .PP Net::SMTP::Server::Client accepts one argument that must be a handle to a connection that will be used for communication. .PP Once you have a new client session, simply call: .PP \&\f(CW$client\fR\->process .PP This processes an \s-1SMTP\s0 transaction. \s-1THIS MAY APPEAR TO HANG\s0 \*(-- \&\s-1ESPECIALLY IF THERE IS A LARGE AMOUNT OF DATA BEING SENT.\s0 Once this method returns, the server will have processed an entire \s-1SMTP\s0 transaction, and is ready to continue. .PP Once \f(CW$client\fR\->process returns, various fields have been filled in. Those are: .PP .Vb 3 \& $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. :) .Ve .SH "AUTHOR AND COPYRIGHT Net::SMTP::Server / SMTP::Server is Copyright(C) 1999, MacGyver (aka Habeeb J. Dihu) . ALL RIGHTS RESERVED." .IX Header "AUTHOR AND COPYRIGHT Net::SMTP::Server / SMTP::Server is Copyright(C) 1999, MacGyver (aka Habeeb J. Dihu) . ALL RIGHTS RESERVED." You may distribute this package under the terms of either the \s-1GNU\s0 General Public License or the Artistic License, as specified in the Perl \s-1README\s0 file. .SH "SEE ALSO" .IX Header "SEE ALSO" Net::SMTP::Server::Server, Net::SMTP::Server::Relay