Question
How to unify IMAP folders between different mail clients and automatically create them?
For example, how to alias "Sent" folder used by Outlook with "Sent Messages" used by Apple Mail.app, so both mail clients will have the same content?
Answer
One of two workarounds might be implemented to enable this behavior:
-
Workaround I:
Change settings on mail client-side: set deleted messages to be stored only in Trash and sent messages to be stored only in Sent.
For more information, refer to the documentation of the mail client used. -
Workaround II:
Warning: This workaround is not officially supported. All changes, committed to the configuration might be overwritten by future Plesk updates, upgrades, or repairs.
Modify IMAP server configuration to enable SPECIAL-USE RFC 6154 tags:
-
Connect to the server via SSH
-
Create and open
/etc/dovecot/conf.d/30-plesk-specialuse.conf
file using a text editor:# vi /etc/dovecot/conf.d/30-plesk-specialuse.conf
-
Add the namespace inbox block to include mailboxes (folders) with special_use tags:
namespace inbox {
separator = .
prefix = INBOX.
inbox = yes
mailbox Sent {
auto = subscribe
special_use = Sent
}
mailbox "Sent Messages" {
auto = no
special_use = Sent
}
mailbox Spam {
auto = create
special_use = Junk
}
}Here, folder Sent Messages will be aliased to the folder Sent, and folders Sent and Spam will be created automatically.
Note: This feature is available in Dovecot 2.1 and newer and is not provided by Courier-IMAP.
For more detailed information refer to the official Dovecot Wiki. -
If Plesk Email Security is installed, create the file
/etc/dovecot/conf.d/custom_sieve/move_spam.sieve
with the following content:require ["fileinto","mailbox"];
if allof (header :contains "X-SPAM-Flag" "Yes")
{
fileinto :create "Spam";
stop;
} -
Create the file
/etc/dovecot/conf.d/99-move_spam.conf
with the following contentplugin {
sieve_after = /etc/dovecot/conf.d/custom_sieve/move_spam.sieve
} -
Reload Dovecot IMAP server to apply new configuration:
# service dovecot reload
-
Note: Newly created folders will not replace the specific existing ones made via the mail client by default like Sent folder for example.