不接收电子邮件:Postfix(CentOS 7)拒绝中继访问

由于某种原因,我最近在CentOS 7上运行的Postfix邮件服务器停止工作,也许是因为我通过Webmin更新了模块,我不知道。 我可以发送电子邮件,但我没有收到电子邮件。 另外,POP3和IMAP不起作用。 我已经尝试了很多东西,但一直没能弄明白,所以我正在寻求一些帮助。

我读了几个主题的话题:

  • 修复Postfix中的“中继访问被拒绝”
  • Postfix / Dovecot中继访问被拒绝
  • Postfix的基本configuration (优秀文章!)
  • Postfix从外部接收电子邮件不工作

我最初的错误:从文件/var/log/maillog Relay access denied

 Jul 31 11:18:40 myhostname postfix/smtpd[6787]: connect from mail-wm0-f51.google.com[74.125.82.51] Jul 31 11:18:40 myhostname postfix/smtpd[6787]: NOQUEUE: reject: RCPT from mail-wm0-f51.google.com[74.125.82.51]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-wm0-f51.google.com> Jul 31 11:18:41 myhostname postfix/smtpd[6787]: disconnect from mail-wm0-f51.google.com[74.125.82.51] 

我的初始设置( /etc/postfix/main.cf )运行命令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 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 html_directory = no mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain newaliases_path = /usr/bin/newaliases.postfix readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES sample_directory = /usr/share/doc/postfix-2.10.1/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination unknown_local_recipient_reject_code = 550 

在阅读我上面提到的文章之后,我定义了mydomainmyhostnamemynetworks ; 现在我得到了一个不同的错误(见下面)。这是main.cf设置的改变:

 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 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5 html_directory = no mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mydomain = mydomain.com myhostname = 9dok43ksalv.hostname.com mynetworks = 11.22.33.44/28, 127.0.0.0/8 myorigin = $mydomain newaliases_path = /usr/bin/newaliases.postfix readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES relay_domains = $mydestination sample_directory = /usr/share/doc/postfix-2.10.1/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination unknown_local_recipient_reject_code = 550 

现在我得到的错误是Recipient address rejected: User unknown in local recipient table; 如下所示:

 connect from mail-wm0-f49.google.com[74.125.82.49] Aug 1 16:22:27 9dok43ksalv postfix/smtpd[2583]: NOQUEUE: reject: RCPT from mail-wm0-f49.google.com[74.125.82.49]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-wm0-f49.google.com> Aug 1 16:22:28 9dok43ksalv postfix/smtpd[2583]: disconnect from mail-wm0-f49.google.com[74.125.82.49] 

显然Postfix没有find电子邮件的最终目的地。 我从来没有configuration过Postfix,所以我现在有点失落了,作为第一个计时器; VestaCP曾经为我照顾这个,直到现在我从来没有遇到过问题。

有人会友好地指点我正确的方向。 我真的很感激再次收到电子邮件,并获得POP3和IMAP的工作。

提前致谢。 如果您需要更多信息,请与我们联系。

错误消息是550 5.1.1本地收件人表中的用户未知

我想您可能需要查看本地收件人地图/别名地图,并确保它们configuration正确。 同样在main.conf中查看mydestinations的值,就好像configuration了域,然后本地交付应该发生

值得阅读这个答案混淆了alias_maps和virtual_alias_maps

下面的一些好的信息以及http://www.postfix.org/postconf.5.html#local_recipient_maps

“本地别名数据库

当本地传送邮件时,本地传送代理通过别名数据库运行每个本地收件人名称。 映射不会影响邮件标题中的地址。 本地别名通常用于实现分发列表,或将标准别名(如postmaster)的邮件定向到真人。 该表还可以用来将Firstname.Lastname地址映射到login名。“

或者可能是虚拟别名地图

“通过这种方式,每个托pipe域名都可以拥有自己的信息等电子邮件地址,但是仍然使用Linux系统账户进行本地邮箱投递。

使用虚拟别名域,每个托pipe地址都被别名为本地UNIX系统帐户或远程地址。 下面的例子显示了如何在fossedu.org和linuxelabs.com域中使用这个机制。“

https://help.ubuntu.com/community/PostfixBasicSetupHowto#Local_Alias_database

https://help.ubuntu.com/community/PostfixBasicSetupHowto#Postfix_virtual_Aliases_for_separate_domains_and_Linux_system_accounts

检查这个:

Postfix:收件人地址被拒绝:本地收件人表中的用户未知

解决scheme(在这种情况下),正如解释的那样,是从行中删除 $ mydomain:

 mydestination = $mydomain, localhost.$mydomain, localhost