zone-eu / zone-mta

📤 Modern outbound MTA cross platform and extendable server application
European Union Public License 1.2
599 stars 96 forks source link

Howto purge a queue ? #333

Closed pydubreucq closed 1 year ago

pydubreucq commented 1 year ago

Hi, I'm looking for a way to purge all email in an active queue ? How can I do that please ? Best Regards, Pierre-Yves

louis-lau commented 1 year ago

You should be able to log into the mongodb database either with a desktop client or the shell. All messages in the queue are stored there. To my knowledge deleting the record removes the item from the queue.

You could also use zonemta-webadmin, but I don't think it has anything to bulk delete. Only individually.

louis-lau commented 1 year ago

Actually, you could use the HTTP api built into zonemta for bulk stuff like this as well, without having to resort to manually going into the db. I believe zonemta-webadmin also uses that api.

pydubreucq commented 1 year ago

Thanks for your help.

If someone read this issue, we do that in mongo

> db.getCollection(“zone-queue”).count({ “sendingZone”: “zone1” })
2004
> db.getCollection(“zone-queue”).deleteMany({ “sendingZone”: “zone1” })
{ “acknowledged” : true, “deletedCount” : 2004 }
> db.getCollection(“zone-queue”).count({ “sendingZone”: “zone1” })
0
>