Introduction
You may want to add auto-delete to a few additional mailboxes for dovecot. By copying the default dovecot configuration and modifying a custom .local file, you can preserve the needed changes.
Procedure
To do this, you need to copy the main.default to main.local and customizing the [% IF expire_trash %]. You'll also need to enable the configuration option within Home » Service Configuration » Mailserver Configuration and enable Auto Expunge Trash. By default, the following is configured:
#expire_dict = db:/var/lib/dovecot/expire.db
expire_dict = proxy::expire
expire = Trash
expire2 = "Deleted Messages"
expire3 = "INBOX.Deleted Messages"
expire4 = INBOX.Trash
expire5 = Junk
expire6 = Spam
expire7 = spam
expire8 = INBOX.Junk
expire9 = INBOX.Spam
expire10 = INBOX.spam
expire11 = INBOX.Sent
expire12 0 .Sent
To create a custom template for this file, perform the following steps:
-
Copy the
/var/cpanel/templates/dovecot2.3/main.default
file to the/var/cpanel/templates/dovecot2.3/main.local
file. This ensures that the system will not overwrite your changes when Dovecot updates during the cPanel & WHM update (upcp
) process. -
Open the
/var/cpanel/templates/dovecot2.3/main.local
file with a text editor. Edit the file to reflect your desired settings. For example:expire_dict = proxy::expire
-
Save your changes to the file.
-
Rebuild the Dovecot mail server with the
/usr/local/cpanel/scripts/builddovecotconf
script. This applies the new configuration settings from the/var/cpanel/templates/dovecot2.3/main.local
file. -
Restart the Dovecot mail server with the
/usr/local/cpanel/scripts/restartsrv_dovecot
script.