stalwartlabs / mail-server

Secure & Modern All-in-One Mail Server (IMAP, JMAP, POP3, SMTP)
https://stalw.art
5.17k stars 212 forks source link

[enhancement]: Purge all mail #658

Open shortstack opened 3 months ago

shortstack commented 3 months ago

Which feature or improvement would you like to request?

Forgive me if this is in the docs and I missed it but I feel like I've gone through all of them at this point. Is there a way to purge all mail from the database? Loving Stalwart so far and this is my last hurdle. Thank you!

Is your feature request related to a problem?

No response

Code of Conduct

mdecimus commented 3 months ago

Do you mean purging deleted and junk emails? Or you want to delete the entire contents of an account? If it is purging deleted/junk you have the auto-expunge feature.

shortstack commented 2 months ago

Purging the entire contents of all accounts, similar to how you can do this in Exchange with Get-Mailbox | Search-Mailbox -DeleteContent -Force

also thank you for responding @mdecimus!

mdecimus commented 2 months ago

I think this is a dangerous feature to be made available globally. To empty an entire account you can post a JMAP request that does this using curl. The request should combine the query method to obtain all ids and then the set method to delete all ids resulting from the query.

shortstack commented 2 months ago

@mdecimus oh snap, did not know this. would you happen to know what that looks like? before i go spending a couple hours in that rabbit hole? this is for a training environment we use at black hat/def con and it would be greatly appreciated... i can pay you in stickers