在 CentOS 6.4 上运行 Postfix 2.6.6。我已在 Active Directory 中配置了虚拟用户查找。当向单个地址发送邮件时,邮件会正确传递到虚拟用户的 Maildir。但是,如果收件人不止一个,则会导致在 vmail 用户的主目录中写入一个文件,该文件的文件名为收件人列表。
这是我的main.cf:
virtual_mailbox_domains = $mydomain
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf,ldap:/etc/postfix/ldap-groups.cf
virtual_uid_maps = static:75003
virtual_gid_maps = static:75003
ldap-用户.cf:
server_host = mailhost.example.com
search_base = cn=Users,dc=example,dc=com
version = 3
query_filter = (&(objectclass=person)(mail=%s))
result_attribute = samaccountname
result_format = %s/Maildir/
后图查询结果:
postmap -q [email protected] ldap:/etc/postfix/ldap-users.cf
usera/Maildir
ldap-groups.cf
server_host = mailhost.example.com
search_base = ou=Test,dc=example,dc=com
version = 3
query_filter = (&(objectclass=group)(mail=%s))
leaf_result_attribute = samaccountname
special_result_attribute = member
result_format = %s/Maildir/
后图查询结果:
postmap -q [email protected] ldap:/etc/postfix/ldap-groups.cf
usera/Maildir/,userb/Maildir/,userc/Maildir/
当我发送邮件到[电子邮件保护]邮件已正确送达,/home/vmail/usera/Maildir/new
但当我将邮件发送至[电子邮件保护]电子邮件正文在第一个收件人的 Maildir 下写成/home/vmail/usera/Maildir
如下:
drwx------. 3 vmail vmail 8192 May 21 13:01 ,userb
drwx------. 3 vmail vmail 8192 May 21 12:58 ,userc
drwx------. 2 vmail vmail 8192 Jun 3 10:32 cur
邮件日志揭示了这一点:
Jun 3 11:09:02 mailhost postfix/virtual[13081]: mail_addr_find: [email protected] -> usera/Maildir/,userb/Maildir/,userc/Maildir/
Jun 3 11:09:02 mailhost postfix/virtual[13081]: deliver_mailbox[2]: set user
_attr: /home/vmail/usera/Maildir/,userb/Maildir/,userc/Maildir/, uid = 75003, gid = 75003
main.cf 中的指令virtual_mailbox_base
仅适用于第一个收件人。我猜这是一个问题,但即使不是,为什么第二个和第三个收件人的邮件会根据第一个收件人的 Maildir 进行传递?
提前感谢有关如何解决此问题的任何建议。
答案1
我所忽略的是ldap:/etc/postfix/ldap-groups.cf
需要被分配到virtual_alias_maps
而/etc/postfix/main.cf
不是反对virtual_mailbox_maps
更正后/etc/postfix/main.cf
:
# Active Directory/LDAP virtual user info
virtual_mailbox_domains = $mydomain
virtual_mailbox_base = /home/vmail
virtual_mailbox_maps = ldap:/etc/postfix/ldap-users.cf
virtual_alias_maps = ldap:/etc/postfix/ldap-groups.cf
virtual_uid_maps = static:75003
virtual_gid_maps = static:75003
更正后/etc/postfix/ldap-groups.cf
:
server_host = mailhost.example.com
search_base = ou=Test,dc=example,dc=com
version = 3
query_filter = (&(objectclass=group)(mail=%s))
leaf_result_attribute = mail
special_result_attribute = member