• crewdk

      Moolevel 0

    I couldn’t find anything about this in the manuals, so I decided to ask here. Is there a way to automatically delete emails older than N days in a specific mailbox? Or can this only be done using external clients?

    Have something to say?

    Join the community by quickly registering to participate in this discussion. We'd like to see you joining our great moo-community!

    • crewdk

        Moolevel 0

      pkernstock Oh, thank you for such a fast reply! I didn’t even think to look for it in the Dovecot section or consider using cron. ))

      • pkernstock

        • Forum Staff
        • volunteer
        Moolevel 58

      Personally, I’m using these cronjobs to purge old emails:

      # Delete mails from junk which are read and older than 4 weeks
      /usr/local/bin/docker-compose exec -T dovecot-mailcow doveadm expunge -A mailbox 'Junk' SEEN savedbefore 4w
      
      # Delete mails from junk which are NOT read and older than 8 weeks
      /usr/local/bin/docker-compose exec -T dovecot-mailcow doveadm expunge -A mailbox 'Junk' not SEEN savedbefore 8w
      No one is typing