无法向本地 root 发送消息

无法向本地 root 发送消息

我在 Raspberrypi 3B+ 机器上使用基于 Debian Stretch 的 mit OpenMediaVault(ARM) 时遇到任何问题。

以下命令不会返回错误,也不会返回邮件:

root@raspberrypi:~# echo "Content" | mail -s "Subject" root
root@raspberrypi:~# mail
No mail for root
root@raspberrypi:~# cat /var/spool/mail/root
root@raspberrypi:~#

从邮件登录

cat /var/log/mail.log
Jul 13 08:12:16 raspberrypi postfix/pickup[1809]: BA9A76059: uid=0 from=<root>
Jul 13 08:12:16 raspberrypi postfix/cleanup[1952]: BA9A76059: message-id=<[email protected]>
Jul 13 08:12:16 raspberrypi postfix/qmgr[1638]: BA9A76059: from=<[email protected]>, size=435, nrcpt=1 (queue active)
Jul 13 08:12:16 raspberrypi postfix/error[1954]: BA9A76059: to=<[email protected]>, orig_to=<root>, relay=none, delay=0.09, delays=0.04/0.03/0/0.02, dsn=5.0.0, status=bounced (raspberrypi.localdomain)
Jul 13 08:12:16 raspberrypi postfix/cleanup[1952]: CBF576061: message-id=<[email protected]>
Jul 13 08:12:16 raspberrypi postfix/bounce[1955]: BA9A76059: sender non-delivery notification: CBF576061
Jul 13 08:12:16 raspberrypi postfix/qmgr[1638]: CBF576061: from=<>, size=2447, nrcpt=1 (queue active)
Jul 13 08:12:16 raspberrypi postfix/qmgr[1638]: BA9A76059: removed
Jul 13 08:12:16 raspberrypi postfix/error[1954]: CBF576061: to=<[email protected]>, relay=none, delay=0, delays=0/0/0/0, dsn=5.0.0, status=bounced (raspberrypi.localdomain)
Jul 13 08:12:16 raspberrypi postfix/qmgr[1638]: CBF576061: removed

如果有任何帮助,我将不胜感激

答案1

解决方案是 /etc/postfix/main.cf 中的以下几行:

myhostname = localhost
mydomain = localdomain
mydestination = $myhostname, localhost.$mydomain, localhost
inet_interfaces = $myhostname, localhost
mynetworks_style = host
default_transport = error: outside mail is not deliverable

重启postfix服务

root@raspberrypi:~# systemctl restart postfix.service

root@raspberrypi:~# echo Test | mail -s test root
root@raspberrypi:~# mail
Mail version 8.1.2 01/15/2001.  Type ? for help.
"/var/mail/root": 1 message 1 new
>N  1 [email protected]  Sat Jul 13 15:55   17/547   test

相关内容