我的环境:
# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.6 (Santiago) # rpm -q postfix postfix-2.6.6-6.el6_5.i686 #
我将Mailbox home_mailbox切换到Maildir/ :
# postconf -n | grep home_mailbox home_mailbox = Maildir/ #
我给自己发了一封testing邮件: [email protected] ,然而电子邮件[email protected]发送到了[email protected] ,无论出于什么原因,它都忽略了我的+A别名。
我的目标是将[email protected]发送到[email protected] ~test/Maildir/.A/而不是[email protected] ~test/Maildir/ 。
我究竟做错了什么? 我错过了什么?
这里是@ sebix的注释的扩展版本。 这个未经testing的解决scheme直接从dovecot 2 wiki: Pigeonhole Sieve示例中获取 。
你需要从dovecot筛子子地址扩展来做到这一点。 把它放在筛脚本。 这里是将电子邮件foo + [email protected]放入垃圾邮件文件夹的简单示例。
require ["fileinto", "envelope", "subaddress"]; if envelope :detail "to" "spam"{ fileinto "Spam"; }
更高级的例子是使用正则expression式来捕获地址扩展,并把它放在同一个文件夹中。 例如,test+ A @example.org将在A子文件夹中发送,test+ B @example.org将在B子文件夹中发送等等
require ["variables", "envelope", "fileinto", "subaddress"]; if envelope :is :user "to" "test" { if envelope :matches :detail "to" "*" { /* Save name in ${name} in all lowercase except for the first letter. * Joe, joe, jOe thus all become 'Joe'. * Of course you can set into all lowercase letter */ set :lower :upperfirst "name" "${1}"; } if string :is "${name}" "" { /* Default case to INBOX */ fileinto "INBOX"; } else { fileinto "${name}"; } }
要使用Postfix,这要求信封“to”仍然包含完整的地址,所以传递它与-a标志。
为本地交付集
mailbox_command = /usr/lib/dovecot/dovecot-lda -a "$RECIPIENT"
或虚拟交付
dovecot unix - nn - - pipe flags=DRhu user=mail:mail argv=/usr/local/libexec/dovecot/dovecot-lda -f ${sender} -d ${user}@${nexthop} -a ${recipient}