Postfix 拒绝接收虚拟邮箱的邮件

Postfix 拒绝接收虚拟邮箱的邮件

我按照本教程设置了一个使用虚拟用户的电子邮件服务器。https://www.rosehosting.com/blog/mailserver-with-virtual-users-and-domains-using-postfix-and-dovecot-on-a-centos-6-vps/

我可以发送电子邮件,但是当我尝试向其中一个虚拟邮箱发送电子邮件时,邮件日志中出现以下错误。

收件人地址被拒绝:虚拟邮箱表中的用户未知;

根据我所做的研究,似乎这一行就是原因。具体来说就是“reject_unauth_destination”。

> smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated, reject_unauth_destination

我尝试删除“reject_unauth_destination”值,然后出现以下错误。

致命:在参数 smtpd_relay_restrictions 或 smtpd_recipient_restrictions 中,指定至少一个工作实例:reject_unauth_destination、defer_unauth_destination、reject、defer、defer_if_permit 或 check_relay_domains

有人知道我该怎么做才能修复这个错误吗?我可以正常登录帐户并发送邮件。除了拒绝电子邮件之外,一切似乎都很好。

这是我的 main.cf postfix 文件的完整副本。

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/postfix/aliases
alias_database = $alias_maps

inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost

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

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES

relay_domains = *
virtual_alias_maps=hash:/etc/postfix/vmail_aliases
virtual_mailbox_domains=hash:/etc/postfix/vmail_domains
virtual_mailbox_maps=hash:/etc/postfix/vmail_mailbox

virtual_mailbox_base = /var/vmail
virtual_minimum_uid = 2222
virtual_transport = virtual
virtual_uid_maps = static:2222
virtual_gid_maps = static:2222

smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated

smtpd_milters = inet:127.0.0.1:8891
non_smtpd_milters = $smtpd_milters
milter_default_action = accept
milter_protocol = 2

我已在 3 个 vmail 文件中添加了记录来配置账户

 vmail_domains - mydomain.com OK
 vmail_mailbox - [email protected] mydomain.com/dan/
 vmail_aliases - [email protected] [email protected]

答案1

错误很明显,你用过postmap吗?试试。postmap -q [email protected] hash:/etc/postfix/vmail_mailbox

为了解决你的问题你需要使用"postmap /etc/postfix/vmail_mailbox and service postfix"

如果您在 Postfix 中使用哈希表,则每次更改文本文件时都需要在文件上使用 postmap 来重新生成 db 文件。

相关内容