
Net::Server::Mail::ESMTP::STARTTLS - Simple implementation of STARTTLS (RFC3207) for Net::Server::Mail::ESMTP

Version 0.02

Simple implementation of STARTTLS (RFC3207) for Net::Server::Mail::ESMTP.
use Net::Server::Mail::ESMTP;
my $server = new IO::Socket::INET Listen => 1, LocalPort => 25;
my $conn;
while($conn = $server->accept)
{
my $esmtp = new Net::Server::Mail::ESMTP socket => $conn;
# activate STARTTLS extension
$esmtp->register('Net::Server::Mail::ESMTP::STARTTLS');
# adding STARTTLS handler
$esmtp->set_callback(STARTTLS => \&tls_started);
$esmtp->process;
}
sub tls_started
{
my ($session) = @_;
# now allow authentication
$session->register('Net::Server::Mail::ESMTP::AUTH');
}


Dan Moore, <dan at moore.cx>

Quoth RFC2487: "Upon completion of the TLS handshake, the SMTP protocol is reset to the initial state (the state in SMTP after a server issues a 220 service ready greeting). The server MUST discard any knowledge obtained from the client, such as the argument to the EHLO command, which was not obtained from the TLS negotiation itself."
Quoth RFC2487: "A server MUST NOT return the TLS extension in response to an EHLO command received after a TLS handshake has completed."
Note, though, that both of the above can be done outside the library.

When the start_SSL call fails, I'm not sure that things will work out so well.
Please report any bugs or feature requests to bug-net-server-mail-esmtp-starttls at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-Server-Mail-ESMTP-STARTTLS. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc Net::Server::Mail::ESMTP::STARTTLS
You can also look for information at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Server-Mail-ESMTP-STARTTLS
http://cpanratings.perl.org/d/Net-Server-Mail-ESMTP-STARTTLS

Net::Server::Mail rules, but I had to rely on Net::Server::Mail::ESMTP::AUTH as an example for how to write an ESMTP::Extension. Thanks to the authors of both!

Copyright 2009 Dan Moore, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.