我有 do.ma.in 及其以下 DNS 记录:
do.ma.in A a.b.c.d
mail.do.ma.in A a.b.c.d
do.ma.in MX mail.do.ma.in
我希望收到一封来自mail.google.com
我的 postfix 的邮件,只发往一个地址[email protected]
,或者至少发往[email protected]
因此,我安装了纯净的postfix
机器a.b.c.d
并编辑了下一个选项 /etc/postfix/main.cf
:
myhostname = mail.do.ma.in
mydomain =do.ma.in
smtpd_recipient_restrictions = permit
其他设置都是默认的。然后我完全重启了 postfix 守护进程service postfix restart
。但是当我发送邮件到 时,[email protected]
我在邮件日志中看不到任何内容,只有在守护进程重启时生成的“已启动”消息:
Feb 11 19:20:29 CentOSPC postfix/master[16510]: daemon started -- version 2.6.6, configuration /etc/postfix
postqueue -p
也是空的
但是,如果我捕获到 25 端口的流量,tcpdump -vv -x -X -s 1500 -i eth1 'port 25'
当我从 gmail 发送邮件时,我会看到一些内容(我的主机是192.168.0.48
,并且 25 端口是从主机 NAT 的192.168.0.49
,它与 有接口a.b.c.d
):
192.168.0.49.33301 > 192.168.0.48.smtp: Flags [S], cksum 0x179b (correct), seq 1811629667, win 42900, options [mss 1430,sackOK,TS val 822583720 ecr 0,nop,wscale 7], length 0
0x0000: 4500 003c 107e 0000 2e06 fa8c c0a8 0031 E..<.~.........1
0x0010: c0a8 0030 8215 0019 6bfb 4663 0000 0000 ...0....k.Fc....
0x0020: a002 a794 179b 0000 0204 0596 0402 080a ................
0x0030: 3107 a1a8 0000 0000 0103 0307 1...........
19:23:20.492856 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
192.168.0.48.smtp > 192.168.0.49.33301: Flags [R.], cksum 0xf990 (correct), seq 0, ack 1811629668, win 0, length 0
0x0000: 4500 0028 0000 4000 4006 b91e c0a8 0030 E..(..@[email protected]
0x0010: c0a8 0031 0019 8215 0000 0000 6bfb 4664 ...1........k.Fd
0x0020: 5014 0000 f990 0000 P.......
那么我错过了什么,需要将哪些选项添加到配置中?
这是postconf -n
[root@CentOSPC]# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = localhost
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, do.ma.in
mydomain = do.ma.in
myhostname = mail.do.ma.in
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit
unknown_local_recipient_reject_code = 550
答案1
您需要将本地交付的域(在您的情况下为 do.ma.in)分配给mydestination
变量main.cf
mydestination = $myhostname, localhost.$mydomain, localhost, do.ma.in