Dovecot 创建文件夹,Postfix 需要文件

Dovecot 创建文件夹,Postfix 需要文件

我曾尝试使用虚拟用户配置 Postfix/Dovecot 组合本指南

我的服务器在 CentOS 6.5 上运行 Postfix 2.6.6 和 Dovecot 2.0.9。

问题是,当我使用 Outlook 2013 连接到服务器(它在 IMAP+SMTP 上连接得很好)并向自己发送测试电子邮件时,我没有收到该电子邮件。查看邮件日志,我可以看到我收到了错误

postfix/virtual[2768]: 9C3D480768: to=<[email protected]>, relay=virtual, delay=1132, delays=1132/0.02/0/0.02, dsn=4.2.0, status=deferred (delivery failed to mailbox /var/vmail/domain.net/user: cannot open file: Is a directory)

错误消息非常清楚,我想,这可能是我之前安装 Cyrus/Postfix 时出现的缺陷。我继续删除 vmail 文件夹,为域创建子文件夹,并将所有内容的所有权更改为 vmail:vmail。我重新启动 postfix 和 dovecot,收件箱目录再次出现。Postfix 继续像以前一样抱怨。然后我尝试删除文件夹,然后创建一个空文件,但这只会使其成为 dovecot 问题而不是 postfix 问题,所以现在 dovecot 说它期望的是一个文件而不是一个目录。

/etc/postfix/main.cf

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
smtpd_sasl_type = dovecot
smtpd_sasl_path = /var/run/dovecot/auth-client
smtpd_sasl_security_options = noanonymous
smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
smtpd_sasl_local_domain = $mydomain
broken_sasl_auth_clients = yes

smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination

/etc/dovecot/dovecot.conf

listen = *
ssl = no
protocols = imap lmtp
disable_plaintext_auth = no
auth_mechanisms = plain login
mail_access_groups = vmail
default_login_user = vmail
first_valid_uid = 2222
first_valid_gid = 2222
mail_location = maildir:/var/vmail/%d/%n

passdb {
    driver = passwd-file
    args = scheme=SHA1 /etc/dovecot/passwd
}
userdb {
    driver = static
    args = uid=2222 gid=2222 home=/var/vmail/%d/%n allow_all_users=yes
}
service auth {
    unix_listener auth-client {
        group = postfix
        mode = 0660
        user = postfix
    }
    user = root
}
service imap-login {
    process_min_avail = 1
    user = vmail
}

最后是我的域/别名/邮箱列表中的一些示例条目

domain.tld        OK # /etc/postfix/vmail_domains
[email protected]   domain.tld/user # /etc/postfix/vmail_mailbox
[email protected]   [email protected] # /etc/postfix/vmail_aliases
[email protected]:oOeIaLM/TyEPOdflb+GlL7d1MhE= # /etc/dovecot/passwd

答案1

答案非常简单。 中的路径/etc/postfix/vmail_mailbox缺少尾部斜杠。 当没有尾部斜杠时,postfix 会将其视为文件,从而假定邮箱为 Mailbox(而不是 Maildir)格式。

通过附加尾随斜杠,postfix 将正确地将目录视为 maildir 格式并进行相应的处理。

例子:

[email protected]   domain.tld/user/
[email protected]   domain.tld/user2/

相关内容