So I had a couple requests recently to restore deleted emails, but they didn’t know when or what was deleted.
I created the following bash script and run it from inside the mailcow-borgmatic container to restore any emails missing from particular domain or user.
You can then copy over what you need and run docker compose exec dovecot-mailcow doveadm quota recalc -u "user@domain"
to rebuild the dovecot cache.