Net::S...l::LMTP(3pm)
β¨ NAME β¨
ok so bestie, welcome to Net::Server::Mail::LMTP π β it's the perl module (3pm, yes we're fancy) that implements the LMTP protocol. That's it, that's the whole vibe. π
πΈ SYNOPSIS πΈ
ok here's the whole thing, no gatekeeping:
use Net::Server::Mail::LMTP;
my @local_domains = qw(example.com example.org);
my $server = IO::Socket::INET->new( Listen => 1, LocalPort => 25 );
my $conn;
while($conn = $server->accept)
{
my $esmtp = Net::Server::Mail::LMTP->new( socket => $conn );
# adding some handlers
$esmtp->set_callback(RCPT => \&validate_recipient);
$esmtp->set_callback(DATA => \&queue_message);
$esmtp->process();
$conn->close();
}
sub validate_recipient
{
my($session, $recipient) = @_;
my $domain;
if($recipient =~ /\@(.*)>\s*$/)
{
$domain = $1;
}
if(not defined $domain)
{
return(0, 513, 'Syntax error.');
}
elsif(not(grep $domain eq $_, @local_domains))
{
return(0, 554, "$recipient: Recipient address rejected: Relay access denied");
}
return(1);
}
sub queue_message
{
my($session, $data) = @_;
my $sender = $session->get_sender();
my @recipients = $session->get_recipients();
return(0, 554, 'Error: no valid recipients')
unless(@recipients);
my $msgid = add_queue($sender, \@recipients, $data)
or return(0);
return(1, 250, "message queued $msgid");
}
π DESCRIPTION π
This class implements the LMTP protocol, aka RFC 2033. iconic behavior fr fr π
This class inherits from Net::Server::Mail::ESMTP. so if you wanna know about the common methods, go read Net::Server::Mail::ESMTP β that's where the shared lore lives π¦
π EVENTS π
ok so this is the descriptions of the callbacks you can use with the set_callback method. and listen β every single handler takes the Net::Server::Mail::ESMTP object as its first argument, plus whatever args that specific callback needs. that's the rule, periodt β¨
π LHLO
Same as ESMTP's EHLO bestie. go see Net::Server::Mail::ESMTP for the details π
πΈ DATA
This one overrides the default DATA event and gives you a per recipient response. It gets called for each recipient, with the data (as a scalar reference, mind you π
) as the first argument, followed by the current recipient.
π¦ SEE ALSO π¦
Please, go check out Net::Server::Mail, Net::Server::Mail::SMTP and Net::Server::Mail::ESMTP. the whole friend group, basically π«Ά
π AUTHOR π
Olivier Poitrey <rs@rhapsodyk.net> π
β AVAILABILITY β
Available on CPAN. yes queen, it's out there π
anonymous Git repository:
git clone git://github.com/rs/net-server-mail.git
Git repository on the web:
<https://github.com/rs/net-server-mail>
π BUGS π
Please use the CPAN system to report a bug (http://rt.cpan.org/). we love a paper trail, no cap π
π LICENCE π
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
fr fr, that ALL CAPS part is not a vibe, it's a legally binding vibe. read it. π
π COPYRIGHT π
Copyright (C) 2002 - Olivier Poitrey, 2007 - Xavier Guimard
ok that's the whole page bestie, you ate it π
β¨ this was Net::Server::Mail::LMTP(3pm) from the perl manual, version perl v5.34.0, dated 2022-05-26 β love that for us, now go write some LMTP π«Άπ
π¦ where this page comes from
- debian bookworm: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-server-mail-perl 0.28-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms