Dovecot:电子邮件客户端和重复的文件夹

所以在我的服务器,我通常会遇到一个问题,不同的电子邮件客户端调用一些特殊的文件夹,如SentTrash不同的名称,如Deleted Items Sent ItemsDeleted Items

我的问题是,我可以以某种方式“别名”所有这些名称,并在内部将它们映射到服务器上的同一个已Sent文件夹?

我设法改变我的dovecot.conf包括部分如:

 mailbox Sent { special_use = \Sent auto=subscribe } mailbox "Sent Messages" { special_use = \Sent } mailbox "Sent Items" { special_use = \Sent } 

这是解决这个烦人的问题的正确方法吗? 它似乎工作,至less有没有在服务器上真正的重复,但一些电子邮件客户端可能会select所有重复的文件夹。

谢谢。

您可以使用需要Dovecot 2.1.10+的邮箱别名插件 ,它在文件系统级别上创build符号链接,以提供具有多个名称的一个目录。 这两个目录具有相同的内容。

已发送邮件和已删除邮件是别名“已发送邮件”和“已删除邮件”的真实邮箱的示例configuration:

 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 } 

不要忘记创build邮箱:

 namespace inbox { mailbox Sent { auto = create # or subscribe special_use = \Sent } mailbox Trash { auto = create special_use = \Trash } } 

另一种可能性是如上所述创build两个不同的邮箱,我复制了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 } } 

使用这种方法,你有两个不同的发件箱。 当用户删除其中一个时,另一个仍然不变。

没有必要使用插件。 转到您的vmail目录,例如:

 cd /var/vmail/example.com/exampleUser/ 

那么,如果您想将所有存储在"Sent Messages"文件夹中的邮件存储到"Sent Messages"文件夹中,只需将"Sent Messages"文件作为第一步通过客户端移动到"Sent"

然后,在/var/vmail/example.com/exampleUser/mail文件夹中,删除"Sent Messages"隐藏文件夹:

 rm -r /var/vmail/example.com/exampleUser/mail/.Sent\ Messages 

在发送任何其他电子邮件之前,继续添加一个符号链接到"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"之一,或者如果你想任何其他解决scheme与其他文件夹指向其他文件夹,并保留邮件只在其中一个。

如果您需要使dovecot和客户端使用"INBOX"作为"Sent"文件夹,则应使用用户名(长行再次)从邮件文件夹中创build符号链接:

 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 } } 

那么它应该工作正常。 我已经经历了这个过程,因为我希望从我的笔记本电脑和手机中将我发送的电子邮件放在我的收件箱文件夹中。 对于笔记本电脑来说,鸽子手机已经足够了,但手机仍然使用"Sent Messages"文件夹,所以我不得不使用符号链接技巧。 在select正确的"Sent""Sent Messages"或任何文件夹以使符号链接进出时要非常小心!

我猜这个插件本身就是一个符号链接,所以你只是在做类似的东西。 使用这种技术,您可以合并所有您想要的文件夹,并保持您的客户端不做任何更改。 🙂