Automatic purging of old email in all mailboxes

Edgar Pettijohn edgar at pettijohn-web.com
Mon Aug 29 19:51:04 UTC 2016


http://wiki.dovecot.org/MailboxSettings

I just started using auto expunge so can't tell you how well it works, but it's worth a look.

Sent from my iPhone

> On Aug 29, 2016, at 2:40 PM, Scott W. Sander <scottwsx96 at gmail.com> wrote:
> 
> I am using a postfix + Dovecot server as a test mail server for which some
> applications in our test environment use as a target to deliver email so
> that our real endusers don't receive messages from our test servers.
> 
> A few of the mailboxes in Dovecot receive hundreds of emails per day.  I'd
> like to automatically remove all emails in all mailboxes and mailbox
> folders that were received more than 90 days prior to the received date.
> As I'm a novice Dovecot administrator, I'm not exactly sure what the best
> way to accomplish this is, but I've started looking at the "doveadm
> expunge" command.  I figure I could create a cron job that calls this
> command with the -A switch and that has a search query that finds all
> emails older than 90 days.
> 
> I'm aware that I can test my query by using the "doveadm search" command.
> The problem is that when I do any sort of search query with that command
> (e.g. "doveadm search -A NEW"), I receive the following error messages:
> 
> Error: User listing returned failure
> doveadm: Error: Failed to iterate through some users
> 
> I've searched for help with this error, but most of the guidance I'm seeing
> refers to making sure that dovecot-sql is configured correctly; however,
> I'm using "passwd-file" for the passdb and not a true database.
> 
> Here is doveconf -n:
> 
> -------
> 
> # 2.2.22 (fe789d2): /etc/dovecot/dovecot.conf
> # Pigeonhole version 0.4.13 (7b14904)
> # OS: Linux 4.4.0-34-generic x86_64 Ubuntu 16.04.1 LTS ext4
> auth_mechanisms = plain login
> hostname = mail.domain.test
> info_log_path = /var/log/dovecot.log
> log_path = /var/log/dovecot.log
> mail_location = maildir:/var/mail/vhosts/%d/%n
> namespace inbox {
>  inbox = yes
>  location =
>  mailbox "Deleted Items" {
>    special_use = \Trash
>  }
>  mailbox Drafts {
>    special_use = \Drafts
>  }
>  mailbox Junk {
>    special_use = \Junk
>  }
>  mailbox "Junk E-Mail" {
>    special_use = \Junk
>  }
>  mailbox Sent {
>    special_use = \Sent
>  }
>  mailbox "Sent Items" {
>    special_use = \Sent
>  }
>  mailbox "Sent Messages" {
>    special_use = \Sent
>  }
>  mailbox Trash {
>    special_use = \Trash
>  }
>  prefix =
> }
> passdb {
>  args = scheme=PLAIN username_format=%u /etc/dovecot/dovecot-users
>  driver = passwd-file
> }
> protocols = " imap lmtp pop3"
> service auth {
>  unix_listener /var/spool/postfix/private/auth {
>    group = postfix
>    mode = 0666
>    user = postfix
>  }
> }
> service imap-login {
>  inet_listener imaps {
>    port = 993
>    ssl = yes
>  }
> }
> service lmtp {
>  unix_listener /var/spool/postfix/private/dovecot-lmtp {
>    group = postfix
>    mode = 0600
>    user = postfix
>  }
> }
> service pop3-login {
>  inet_listener pop3s {
>    port = 995
>    ssl = yes
>  }
> }
> ssl = required
> ssl_cert = </etc/ssl/certs/appserver4_combined.pem
> ssl_key = </etc/ssl/private/appserver4_key.pem
> userdb {
>  args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
>  driver = static
> }
> 
> -------
> 
> Thank you in advance!


More information about the dovecot mailing list