We log search terms to improve our documentation. For more information, read our Privacy Policy.
How to Enable and Disable the Dovecot Mail Log Plugin
Valid for versions 132 through the latest version
Last modified: 2026 July 8
Overview
This document explains how to enable and disable the Dovecot mail log plugin. The additional entries to the /var/log/maillog file can help you diagnose issues with mail delivery.
The plugin will add the following entries to the log file:
- Setting and removing the
\Deletedflag - Expunging (includes autoexpunge)
- Copying mails to another mailbox
- Mailbox creations
- Mailbox deletions
- Mailbox renames
- Any flag changes
- Saves
- The mail log plugin is not configurable through the WHM interface. To enable or disable it, you must manually update the Dovecot configuration templates and rebuild the Dovecot configuration.
- The additional log entries will increase the size of the log files and cause the system to archive them more frequently.
- The system uses the
/var/cpanel/templates/dovecot/directory to generate Dovecot configuration. To make persistent changes, you must create and edit a local template in this directory.
Enable the Dovecot mail log plugin
To enable the Dovecot mail log plugin, perform the following steps:
-
Log in to your server via SSH as the
rootuser. -
Run the following command to determine if a local template file already exists:
stat /var/cpanel/templates/dovecot/main.local- If a template file does not exist, create one by running the following command:
cp -v /var/cpanel/templates/dovecot/main.{default,local}
- If a template file does not exist, create one by running the following command:
-
Open the local template file in a text editor:
vi /var/cpanel/templates/dovecot/main.local -
Locate the
mail_plugins {}block. Ensure that themail_logandnotifyplugins are enabled in the appropriatemail_pluginsconfiguration. For example:1 2 3 4 5 6 7 8mail_plugins { quota = yes mail_compress = yes imap_quota = yes virtual = yes mail_log = yes notify = yes }Note:If the template already defines
protocol_imap.mail_plugins, add themail_logandnotifyplugins to that configuration instead of the defaultmail_pluginsblock. -
Locate an existing
plugin {}block. If one does not exist, create it. Add or update the following settings:1 2 3 4plugin { mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename mail_log_fields = uid box msgid size } -
Rebuild the Dovecot configuration and restart the service:
/scripts/builddovecotconf && /scripts/restartsrv_dovecot
To verify that the plugin is logging events, run the following command and perform a mail action, such as moving or deleting a message:
tail -fn0 /var/log/maillogDisable the Dovecot mail log plugin
To disable the Dovecot mail log plugin, perform the following steps:
-
Log in to your server via SSH as the
rootuser. -
Remove or rename the local Dovecot template file:
mv -vi /var/cpanel/templates/dovecot/main.local{,.bak} -
Rebuild the Dovecot configuration and restart the service:
/scripts/builddovecotconf && /scripts/restartsrv_dovecot