如何使用 postfix 发送邮件到另一台服务器?

如何使用 postfix 发送邮件到另一台服务器?

我有两台服务器:

在服务器1中,IP:192.168.190.176,我已经配置main.cf

myhostname = ubuntu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = ubuntu, 192.168.190.171.ubuntu, 192.168.190.171
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

在 server2 中,IP:192.168.190.171,我已配置如下:

myhostname = ubuntu
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = ubuntu, 192.168.190.176.ubuntu, 192.168.190.176
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

当我通过命令从server1向server2发送邮件时:

echo "Test" | mail -s "Test Postfix" quocchi@[192.168.190.171]

在server2中,/var/spool/mail/quocchi是空的。

在server1中:/var/log/mail.log

Apr 23 17:37:27 ubuntu postfix/qmgr[3452]: 17902800A9: from=<root@ubuntu>, size=311, nrcpt=1 (queue active)
Apr 23 17:37:27 ubuntu postfix/local[3465]: 17902800A9: to=<quocchi@ubuntu>, relay=local, delay=0.34, delays=0.15/0.15/0/0.05, dsn=2.0.0, status=sent (delivered to mailbox)
Apr 23 17:37:27 ubuntu postfix/qmgr[3452]: 17902800A9: removed

在服务器2中:

Apr 23 19:35:59 ubuntu postfix/smtpd[10688]: lost connection after CONNECT from unknown[192.168.190.17$
Apr 23 19:35:59 ubuntu postfix/smtpd[10688]: disconnect from unknown[192.168.190.176]

我该如何正确设置它?

相关内容