因此,在我的伺服器中,我通常會遇到一個問題,不同的電子郵件用戶端會呼叫一些特殊的資料夾,例如Sent
和等Trash
不同的名稱。Sent Items
Deleted Items
Sent
我的問題是,我可以以某種方式“別名”所有這些名稱並在內部將它們映射到伺服器上的相同資料夾嗎?
我設法更改了我的dovecot.conf
包含部分,例如:
mailbox Sent {
special_use = \Sent
auto=subscribe
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox "Sent Items" {
special_use = \Sent
}
這是「解決」這個惱人問題的正確方法嗎?它似乎有效,至少伺服器上實際上沒有重複,但某些電子郵件用戶端可能會選擇所有重複的資料夾。
謝謝。
答案1
您可以使用信箱別名插件需要 Dovecot 2.1.10+,它在檔案系統層級建立符號鏈接,以提供具有多個名稱的目錄。兩個目錄具有相同的內容。
範例配置,其中傳送和垃圾是別名「已發送郵件」和「已刪除郵件」的真實郵件信箱:
mail_plugins = $mail_plugins mailbox_alias
plugin {
mailbox_alias_old = Trash
mailbox_alias_new = Deleted Items
mailbox_alias_old2 = Sent
mailbox_alias_new2 = Sent Items
}
不要忘記建立郵箱:
namespace inbox {
mailbox Sent {
auto = create # or subscribe
special_use = \Sent
}
mailbox Trash {
auto = create
special_use = \Trash
}
}
另一種可能性是創建兩個不同的郵箱,正如你提到的,我複製了一部分conf.d/15-mailboxes.conf
namespace inbox {
# For \Sent mailboxes there are two widely used names. We'll mark both of
# them as \Sent. User typically deletes one of them if duplicates are created.
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
}
使用此方法,您有兩個不同的寄件匣。當用戶刪除其中一個時,另一個仍然存在不變。
答案2
無需使用該插件。前往您的 vmail 目錄,例如:
cd /var/vmail/example.com/exampleUser/
然後,如果您希望將所有訊息儲存到"Sent Messages"
要儲存到該資料夾中的"Sent"
資料夾中,只需將檔案移入"Sent Messages"
您"Sent"
的用戶端作為第一步。
然後,在/var/vmail/example.com/exampleUser/mail
資料夾中刪除"Sent Messages"
隱藏資料夾:
rm -r /var/vmail/example.com/exampleUser/mail/.Sent\ Messages
在發送任何其他電子郵件之前,請繼續將符號連結新增至隱藏資料夾"Sent"
("Sent Messages"
此處較長,如果您複製並貼上,請小心操作):
ln -s /var/vmail/example.com/exampleUser/mail/.Sent /var/vmail/example.com/exampleUser/mail/.Sent\ Messages
這應該工作正常。如果您想要將"Sent Items"
或"Mail Sent"
或任何其他資料夾符號連結到該"Sent"
資料夾,或者如果您想要任何其他解決方案,其中其他資料夾指向其他資料夾並將郵件僅保留在其中一個資料夾中,則只需重複相同的過程即可。
如果您需要將 dovecot 和用戶端用作"INBOX"
資料"Sent"
夾,則應使用使用者名稱從郵件資料夾建立符號連結(再次長行):
ln -s /var/vmail/example.com/exampleUser/mail/ /var/vmail/example.com/exampleUser/mail/.Sent\ Messages
除非你沒有改變它。然後/etc/dovecot/conf.d/15-mailboxes.conf
在行中編輯:
namespace inbox {
# For \Sent mailboxes there are two widely used names. We'll mark both of
# them as \Sent. User typically deletes one of them if duplicates are created.
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
}
或其他等價物,使它們成為:
namespace inbox {
# For \Sent mailboxes there are two widely used names. We'll mark both of
# them as \Sent. User typically deletes one of them if duplicates are created.
mailbox INBOX {
special_use = \Sent
}
mailbox INBOX {
special_use = \Sent
}
}
您可以注意到,現在兩個是相同的,因此您只需刪除一個即可:
namespace inbox {
# For \Sent mailboxes there are two widely used names. We'll mark both of
# them as \Sent. User typically deletes one of them if duplicates are created.
mailbox INBOX {
special_use = \Sent
}
}
那麼它應該可以正常工作。我經歷了這個過程,因為我希望我的筆記型電腦和手機發送的電子郵件都位於我的收件匣資料夾中。 dovecot hack 對於筆記型電腦來說已經足夠了,但手機繼續使用該"Sent Messages"
資料夾,所以我不得不使用符號連結技巧。在選擇正確的"Sent"
或"Sent Messages"
任何資料夾來建立符號連結時要非常小心!
我猜這個插件本身只是做一個符號鏈接,所以你只是在做類似的東西。透過這種技術,您可以合併您想要的所有資料夾,並使您的客戶無需任何更改即可正常運作。 :-)