我在让 Exim 与 Cyrus lmtp 对话时遇到了问题。
我知道 lmtp 正在接收。它正在监听端口 2003。我使用以下 perl 脚本对其进行了测试。
!/usr/bin/perl -w
use Net::LMTP;
my $lmtp = Net::LMTP->new('localhost', 2003);
$lmtp->mail($ENV{USER});
$lmtp->to('[email protected]');
$lmtp->data();
$lmtp->datasend("To: postmaster\n");
$lmtp->datasend("\n");
$lmtp->datasend("A simple test message\n");
$lmtp->dataend();
$lmtp->quit;
执行它会生成一个文件,1.出现在相应的 cyrus spool 文件夹中:
root@myhost:/var/spool/cyrus/mail/domain/e/example.com/t/user/test# cat 1.
Return-Path: <[email protected]>
Received: from myhost.example.net (localhost [127.0.0.1])
by myhost.example.net (Cyrus 2.5.10-Debian-2.5.10-3) with LMTPA;
Sun, 07 Oct 2018 12:45:48 +0100
X-Sieve: CMU Sieve 2.4
To: postmaster
Message-ID: <[email protected]>
Date: Sun, 07 Oct 2018 12:45:48 +0100
A simple test message
我正在运行我自己定制的 exim 版本。
执行 exim 的 -bt 测试路由选项
/usr/exim/bin/exim -bt [email protected]
结果是
[email protected]
router = cyrus_vdom, transport = cyrus_ltcp
以下是 Exim 路由器和传输:
cyrus_vdom:
driver = accept
domains = +cyrus_domains
transport = cyrus_ltcp
no_more
cyrus_ltcp:
driver = smtp
protocol = lmtp
hosts = localhost
port = 2003
消息滞留在 exim 中,并且正在执行
exim -qff
不会将它们移出。
2018-10-07 12:35:48 exim 4.91 daemon started: pid=11455, -q30m, listening for SMTP on port 25 (IPv6 and IPv4) port 587 (IPv6 and IPv4) and for SMTPS on port 465 (IPv6 and IPv4)
2018-10-07 12:35:48 Start queue run: pid=11456
2018-10-07 12:35:48 1g8uZF-00027o-TS Message is frozen
2018-10-07 12:35:48 1g8oBv-0000L0-JO Message is frozen
2018-10-07 12:35:48 End queue run: pid=11456
2018-10-07 13:05:48 Start queue run: pid=11812
2018-10-07 13:05:48 1g8uZF-00027o-TS Message is frozen
2018-10-07 13:05:48 1g8oBv-0000L0-JO Message is frozen
2018-10-07 13:05:48 End queue run: pid=11812
2018-10-07 13:35:49 Start queue run: pid=11955
2018-10-07 13:35:49 1g8oBv-0000L0-JO Message is frozen
2018-10-07 13:35:49 1g8uZF-00027o-TS Message is frozen
2018-10-07 13:35:49 End queue run: pid=11955
欢迎任何建议。
答案1
Ping localhost 导致
PING localhost(localhost (::1)) 56 data bytes
64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.039 ms
64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.046 ms
64 bytes from localhost (::1): icmp_seq=3 ttl=64 time=0.047 ms
显然是 IPv6。
跑步
netstat -anp
显示端口 2003 没有在 IPv6 上被监听,只有 IP4 被监听。
将 exim 传输主机更改为此即可修复该问题。
cyrus_ltcp:
driver = smtp
protocol = lmtp
hosts = 127.0.0.1
port = 2003
allow_localhost