我们在CentOS 6机器上使用Postfix,具有以下configuration。 我们使用PHP的mail()函数发送基本的密码重置电子邮件,但有一个问题。
正如你将看到的,mydomain和myhostname是正确设置的,afaik。
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 mydomain = ***.ch myhostname = test.***.ch 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 unknown_local_recipient_reject_code = 550
现在,这是Postfix的/var/log/maillog中发送邮件到***.***@***.ch ,其中***.ch是我们的发送服务器test.***.ch is on:
Dec 13 16:55:06 R12X0210 postfix/pickup[6831]: E6D6311406AB: uid=48 from=<apache> Dec 13 16:55:06 R12X0210 postfix/cleanup[6839]: E6D6311406AB: message-id=<20121213155506.E6D6311406AB@test.***.ch> Dec 13 16:55:07 R12X0210 postfix/qmgr[6832]: E6D6311406AB: from=<apache@test.***.ch>, size=1276, nrcpt=1 (queue active) Dec 13 16:55:52 R12X0210 postfix/smtp[6841]: E6D6311406AB: to=<***.***@***.ch>, relay=mail.***.ch[**.**.249.3]:25, delay=46, delays=0.18/0/21/24, dsn=5.0.0, status=bounced (host mail.***.ch[**.**.249.3] said: 550 Sender Rejected (in reply to RCPT TO command)) Dec 13 16:55:52 R12X0210 postfix/cleanup[6839]: 8562C11406AC: message-id=<20121213155552.8562C11406AC@test.***.ch> Dec 13 16:55:52 R12X0210 postfix/bounce[6848]: E6D6311406AB: sender non-delivery notification: 8562C11406AC Dec 13 16:55:52 R12X0210 postfix/qmgr[6832]: 8562C11406AC: from=<>, size=3065, nrcpt=1 (queue active) Dec 13 16:55:52 R12X0210 postfix/qmgr[6832]: E6D6311406AB: removed Dec 13 16:55:52 R12X0210 postfix/local[6850]: 8562C11406AC: to=<root@test.***.ch>, orig_to=<apache@test.***.ch>, relay=local, delay=0.13, delays=0.07/0/0/0.05, dsn=2.0.0, status=sent (delivered to mailbox) Dec 13 16:55:52 R12X0210 postfix/qmgr[6832]: 8562C11406AC: removed
所以接收服务器拒绝发送者(日志输出的第4行)。 我们已经与其他收件人一起对其进行了testing,结果表明,这个问题可能与我们的设置完全无关,但与收件人有关。
不过,在这个问题上,我想确保我们不会在我们这边做出明显的错误configuration。
首先,你应该通知PHP邮件()函数谁是邮件的发件人,如果你不这样做,将采取运行PHP的用户的名字,并添加@test。*****。ch到它我想testing。****。ch没有MXlogging,不用于接收邮件。
现在给大家的build议是:
当处理发送邮件的卫星邮箱时,这是我的方法(当你没有testing.ch。ch作为一个单独的邮件域)。
在主邮件服务器上,我为每个服务器创build一个发送邮件的帐户,我使用这个帐户信息将所有邮件转发到主邮件服务器,以便他可以处理进一步的交付。 设置这个看看smtp_sasl选项。
之后,创build一个具有以下内容的文件/ etc / postfix / generic:
@test.*****.ch server.test@*****.ch
并运行:
postmap hash:/etc/postfix/generic
现在添加到你的main.cf文件中:
smtp_generic_maps = hash:/etc/postfix/generic
对于root用户(通过/ etc / aliases或者/root/.forward)转发所有邮件到系统pipe理员的电子邮件地址来说,这是很好的措施。
当然,你需要在这之后重新启动Postfix。
所有这些需要处理几个问题:
据我所知,目标服务器不喜欢发件人apache@test.***.ch
您可以尝试将myorigin = $mydomain添加到Postfix main.cfconfiguration文件
接收方域名是否进行发件人validation? 如果是这样test.xxxxx.ch有正确的DNS和/或MXlogging。 接收主机上的日志说什么,因为他们会提供更多的信息。 我将确保test.xxxx.ch具有正确的dns / mx,并接受一个将响应[email protected]的RCPT TO的传入连接,以便在接收主机尝试执行发送者validation时将传递。