feat: use new version of Net::LMTP
This commit is contained in:
parent
cef7411ec1
commit
198829ad45
35
queue/lmtp
35
queue/lmtp
@ -1,8 +1,8 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Qpsmtpd::Constants;
|
||||
use Qpsmtpd::DSN;
|
||||
use Qplmtpd::Constants;
|
||||
use Qplmtpd::DSN;
|
||||
use Net::LMTP;
|
||||
|
||||
|
||||
@ -28,21 +28,34 @@ sub lmtp_transfer
|
||||
{
|
||||
my ($self, $transaction, $lmtp_host, $lmtp_port, $lmtp_user) = @_;
|
||||
|
||||
my $lmtp = Net::LMTP->new($lmtp_host, $lmtp_port);
|
||||
$lmtp->hellp($self->{qp}->config("me"));
|
||||
$lmtp->mail($transaction->sender->address);
|
||||
$lmtp->recipient($lmtp_user);
|
||||
$lmtp->data();
|
||||
$lmtp->datasend($transaction->header->as_string);
|
||||
my $lmtp = Net::LMTP->new(
|
||||
$lmtp_host,
|
||||
Port => $lmtp_port,
|
||||
Timeout => 60,
|
||||
Hello => $self->qp->config("me"),
|
||||
) || die $!;
|
||||
|
||||
|
||||
$lmtp->mail($transaction->sender->address || "")
|
||||
or return DECLINED, "Unable to queue message ($!)";
|
||||
$lmtp->to($lmtp_user) or return DECLINED, "Unable to queue message ($!)";
|
||||
$lmtp->data() or return DECLINED, "Unable to queue message ($!)";
|
||||
$lmtp->datasend($transaction->header->as_string)
|
||||
or return DECLINED, "Unable to queue message ($!)";
|
||||
$transaction->body_resetpos;
|
||||
while (my $line = $transaction->body_getline) {
|
||||
$lmtp->datasend($line)
|
||||
or return DECLINED, "Unable to queue message ($!)";
|
||||
}
|
||||
$lmtp->dataend();
|
||||
$lmtp->quit();
|
||||
$lmtp->dataend() or return DECLINED, "Unable to queue message ($!)";
|
||||
my $qid = $lmtp->message();
|
||||
my @list = split(' ', $qid);
|
||||
$qid = pop(@list);
|
||||
|
||||
$lmtp->quit() or return DECLINED, "Unable to queue message ($!)";
|
||||
|
||||
$self->log(LOGINFO, "finished queueing");
|
||||
return OK;
|
||||
return OK, "queued as $qid";
|
||||
|
||||
return DECLINED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user