Can't recursively delete mailboxes

Murray T. | Dreamscape murray.t at dreamscapenetworks.com
Thu Aug 17 10:40:01 EEST 2017


Hi Steffen,

Thanks for the reply.  We have a regular need to purge mailboxes completely.  Our users delete the mailboxes through a GUI and we use a script to delete the mailbox via a doveadm mailbox delete command.   We need the mailbox and contents completely removed to prevent orphaned mailboxes lying around to save us disk storage.   The user also expects the mailbox and its contents to be removed.   We are currently using the command below to try and purge the contents of the mailbox but it doesn't seem to always purge all the contents.   

doveadm -o doveadm_password=$doveadm_pass expunge -S $mailstore:24245 -u $mail mailbox '*' all" 

When I saw there was a new -r option to doveadm mailbox delete I thought that would do what we need but it doesn't appear so.  Please let me know if there is another way we can remove mailbox and all of its sub-folders and contents via doveadm.

Thanks

Murray 


-----Original Message-----
From: Steffen Kaiser [mailto:skdovecot at smail.inf.fh-brs.de] 
Sent: Thursday, 17 August 2017 3:27 PM
To: Murray T. | Dreamscape <murray.t at dreamscapenetworks.com>
Cc: 'dovecot at dovecot.org' <dovecot at dovecot.org>
Subject: Re: Can't recursively delete mailboxes

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 17 Aug 2017, Murray T. | Dreamscape wrote:

> This appears to be some sort of dovecot bug.  When I use the -r option to recursively delete a mailbox and sub-folders, it removes the sub-folders but not the inbox.  It gives me the error below:
>
> doveadm mailbox delete -u denise at lifelinetechnique.com.au -r -s inbox
> doveadm(denise at lifelinetechnique.com.au): Error: Can't delete mailbox inbox: INBOX can't be deleted.
>
> Our user database is in ldap and I am using dovecot-ee v2:2.2.31.2-1.  Could you please acknowledge that this is a bug or let me know the correct way of recursively deleting a mailbox as there is nothing in the man page about the -r option.

It's on purpose:

         if (mailbox_is_any_inbox(box)) {
                 /* IMAP protocol allows this, but I think it's safer to
                    not allow it. */
                 mailbox_free(&box);
                 client_send_tagline(cmd, "NO INBOX can't be deleted.");
                 return TRUE;
         }

Why do you want to delete the INBOX of the user?

- -- 
Steffen Kaiser
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEVAwUBWZVFPXz1H7kL/d9rAQIs2wf/X2l5XvHLit36SV9ZwEp6xXccfEv4W+92
nelVf0hk9pSAB5Ai2OkjnTyEMWdCB5hOsoz7saNazjTK6IXd/0C2mIRgZvkUVSXT
tEYIf7rd+IAVYSwzmYKxYagcmf36lwzzqMx8PR5bC4w5n9XvyrO6VNVdULvFu8G1
7jzdBWDcSeLocgQj+V5VtVjOnSqyD3jsRZ1uUW7vLeeJPm97DDtAuIzKs39TfvHt
tNBGRje0kGIs2jjdsE9CIDNG053LaLb6bz2BnCBPsRL39uE/L6++I/IF9Gk8nTTk
4skKAWdZTfinQh0w2zaFR2KiBLN5cdJtI4MpN51uIxKH+zKdHaAhpw==
=MhpO
-----END PGP SIGNATURE-----


More information about the dovecot mailing list