Listener: Dovecot iterate

  • I like to be able to use Dovecot's doveadm to expunge spam automatically for all mail accounts, but i-MSCP does not define an iterate query. From what i read on the forum that is because of incompatibility with Dovecot <v2.x.
    Since Dovecot on my system is >v2.x i decided to write a listener for this (well, adapted an existing listener tbh :blush: ).


    With this listener in place i can use a cronjob to clear out messages older than 30 days from the .Junk folder for all mail accounts with this command:


    doveadm expunge -A mailbox INBOX.Junk savedbefore 30d


    My actual cronjob also learns spam/ham for all accounts before expunging spam:

    Shell-Script
    1. #!/bin/bash# Learn spam/hamsa-learn --ham /var/mail/virtual/*/*/cur/sa-learn --spam /var/mail/virtual/*/*/.Junk/# Expunge spamdoveadm expunge -A mailbox INBOX.Junk savedbefore 30d


    This script is saved as an executable file: /etc/cron.daily/spamjob



    Here is the Listener file. If you want to use it then save as /etc/imscp/listeners.d/10_dovecot_iterate.pl:



    Nuxwin : Maybe it is possible to add the iterate query back into i-MSCP repository and make i-MSCP only install this for systems where Dovecot version is >2.x?

  • @DSX


    Well, we support only dovecot >= 2.x right now. In past, this was different. I'll readd it ;)

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • @DSX


    A fix has been added in the 1.3.x branch. See https://github.com/i-MSCP/imsc…379b9a6d8a290364f28752f84
    This fix will be part of next release.


    Thank you for your report.


    Thread closed.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206