我在 CentOS 机器上使用 Postfix、Dovecot 和 MySQL 设置了一个邮件服务器来为一些虚拟用户提供服务,但由于某种原因,它没有将电子邮件存储在正确的文件夹中。Postfix 和 Dovecot 都使用名为语音邮件其主目录设置为/主页/vmail
域名及其关联的电子邮件地址存储在 MySQL 数据库中,Postfix 应在 /home/vmail 中创建其邮箱。
电子邮件应存储在以下格式的文件夹中:
但无论它们的目标地址是什么,它们都会被转储到这个文件夹中:
- /主页/vmail/vmail/Maildir
因此,使用任何电子邮件客户端都无法访问上述邮件。其他一切(身份验证、发送/接收电子邮件)都正常,只是邮件没有存储在应有的位置。
使用 Courier 而不是 Dovecot 的类似设置按预期工作,所以我认为这仅与 Dovecot 相关。
以下是我的鸽舍配置的最低限度:
protocols = imap pop3
log_timestamp = "%Y-%m-%d %H:%M:%S"
mail_location = maildir:/home/vmail/%d/%n/Maildir
ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
ssl_key = </etc/pki/dovecot/private/dovecot.pem
namespace {
type = private
separator = .
prefix = INBOX.
inbox = yes
}
service auth {
unix_listener auth-master {
mode = 0600
user = vmail
}
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}
user = root
}
service auth-worker {
user = root
}
protocol lda {
log_path = /home/vmail/dovecot-deliver.log
auth_socket_path = /var/run/dovecot/auth-master
postmaster_address = [email protected]
}
protocol pop3 {
pop3_uidl_format = %08Xu%08Xv
}
passdb {
driver = sql
args = /etc/dovecot/dovecot-sql.conf.ext
}
userdb {
driver = static
args = uid=5000 gid=5000 home=/home/vmail/%d/%n allow_all_users=yes
}
以下是我更改的默认设置中的后缀参数
myhostname = testcentos.com
mydestination = localhost, localhost.localdomain
mynetworks = 127.0.0.0/8
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_mailbox_base = /home/vmail
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, permit
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/pki/dovecot/certs/dovecot.pem
smtpd_tls_key_file = /etc/pki/dovecot/private/dovecot.pem
virtual_maildir_extended = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
inet_interfaces = all
message_size_limit = 30720000
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
virtual_create_maildirsize = yes
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
答案1
检查你的 /etc/postfix/master.cf 文件,应该包含类似以下内容:
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}