QPSMTPD-MailserverInterface/Net/LMTP.pm

39 lines
791 B
Perl
Raw Normal View History

package Net::LMTP;
2025-02-07 17:43:31 +01:00
use strict;
use warnings;
use base 'Net::SMTP';
2025-02-07 17:43:31 +01:00
use Net::Cmd;
sub hello {
my $me = shift;
my $domain = shift || "localhost.localdomain";
my $ok = $me->_LHLO($domain);
my @msg = $me->message;
if ($ok) {
my $h = ${*$me}{'net_smtp_esmtp'} = {};
foreach my $ln (@msg) {
$h->{uc $1} = $2 if $ln =~ /([-\w]+)\b[= \t]*([^\n]*)/;
}
}
elsif ($me->status == CMD_ERROR) {
@msg = $me->message if $ok = $me->_HELO($domain);
}
return unless $ok;
${*$me}{net_smtp_hello_domain} = $domain;
$msg[0] =~ /\A\s*(\S+)/;
return ($1 || " ");
}
sub _EHLO { shift->unsupported(@_);}
sub _HELO { shift->unsupported(@_);}
sub _LHLO { shift->command("LHLO", @_)->response() == CMD_OK }
1;