Email

篩子:將子地址的郵件放入文件夾

  • January 20, 2019

是否可以編寫像這樣的篩子規則

if envelope :detail "to" "$x" {
 fileinto "inbox.$x";
}

但盡一切可能$x?即,如果使用者創建了一個文件夾inbox.foo,我希望郵件user+foo@domain自動到達那裡。該規範似乎不支持這一點。

原來這就是變數擴展的用途。

require "variables";
if envelope :detail :matches "to" "*" {
 fileinto "inbox.${1}";
}

對我來說,這個工作:

require ["variables", "fileinto", "envelope", "subaddress", "mailbox"];

if envelope :matches :detail "to" "*" {
   # you can prefix with INBOX/ or INBOX. if necessary
   # remove :create if you want to permit only existing mailboxes
   fileinto :create "${1}";
}

請參閱此處的範例: https ://wiki.dovecot.org/Pigeonhole/Sieve/Examples

顯然,這也只是一個打開的選項: lmtp_save_to_detail_mailbox=yes

引用自:https://serverfault.com/questions/434951