|
NAMEPOE::Component::Server::SMTP - SMTP Protocol ImplementationSYNOPSISuse POE; use POE::Component::Server::SMTP; POE::Component::Server::SMTP->spawn( Port => 2525, InlineStates => { HELO => \&smtp_helo, QUIT => \&smtp_quit, }, ); sub smtp_helo { my ($heap) = $_[HEAP]; my $client = $heap->{client}; $client->put( SMTP_OK, 'Welcome.' ); } sub smtp_quit { my ($heap) = $_[HEAP]; my $client = $heap->{client}; $client->put( SMTP_QUIT, 'Good bye!' ); $heap->{shutdown_now} = 1; } $poe_kernel->run; exit 0; DESCRIPTIONPOE::Component::Server::TCP implements the SMTP protocol for the server. I won't lie, this is very low level. If you want to support any command other than HELO and QUIT, you'll have to implement it yourself, and define it in your "InlineStates", "PackageStates", or "ObjectStates".This module uses POE::Session::MultiDispatch to allow for "Plugins" using "PackageStates" and "ObjectStates". Also, as of this release, POE version 0.24 is out. This module relies on a CVS version of POE. ConstantsThis module exports a bunch of constants by default.SMTP_SYTEM_STATUS SMTP_SYSTEM_HELP SMTP_SERVICE_READY SMTP_QUIT SMTP_OK SMTP_WILL_FORWARD SMTP_CANNOT_VRFY_USER SMTP_START_MAIL_INPUT SMTP_NOT_AVAILABLE SMTP_SERVICE_UNAVAILABLE SMTP_LOCAL_ERROR SMTP_NO_STORAGE SMTP_SYNTAX_ERROR SMTP_ARG_SYNTAX_ERROR SMTP_NOT_IMPLEMENTED SMTP_BAD_SEQUENCE SMTP_ARG_NOT_IMPLEMENTED SMTP_UNAVAILABLE SMTP_USER_NOT_LOCAL SMTP_QUOTA_LIMIT SMTP_MAILBOX_ERROR SMTP_NO_SERVICE SMTP_TRANSACTION_FAILED If you don't know what these mean, see the source. spawn( %args )Create a new instance of the SMTP server. The argument list follows.
EventsThere are only three builtin events. This way, the default POE::Component::Server::SMTP distribution is completley secure. Unless otherwise noted, event names corrispond to the uppercase version of the verb supplied from the client during an SMTP connection (HELO, VRFY, RCPT).Any input supplied after the command verb will be available to the event handler in $_[ARG1], the command name itself is available in $_[ARG0].
In the source of this module there are two example handlers for handling the "DATA" event. The "DATA" event is kind of tricky, so refer to the "smtpd_DATA" and "smtpd_gotDATA" subroutines in the source.
BUGSNo doubt.It should be noted that this is extremley early code. After all, it relies on features of POE that haven't even been released. Anything could change! See http://rt.cpan.org to report bugs. Known IssuesThe following is what I would consider known issues.
AUTHORCasey West <casey@geeknest.com>THANKSMeng Wong, and http://pobox.com/COPYRIGHTCopyright (c) 2003 Casey West. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.SEE ALSOperl, POE.POD ERRORSHey! The above document had some coding errors, which are explained below:
Visit the GSP FreeBSD Man Page Interface. |