zone-eu / zone-mta

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

Help remove from queue #404

Closed ravivgolov closed 4 weeks ago

ravivgolov commented 4 weeks ago

Hello

I need to urgently remove around 10,000 emails from a specific sender domain from the queue. I'm currently connected to Mongosh and have switched to the zone-mta db. However, I'm only able to see the recipient, and not the sender. How can I filter and remove the emails from the specific sender domain?

I simply removed from the mail.chunks - will that also remove it from the zone-queue db? Is that enough?

louis-lau commented 4 weeks ago

In mail.files you can find all the metadata including the sender, and match the id to the messages in zone-queue.

I'm not sure what happens if you only remove the mail.chunks and mail.files without also removing the message from the queue. I think they may fail to send perpetually and automatically get garbage collected after 30 days? Not sure.

louis-lau commented 4 weeks ago

I would probably have removed the messages from zone-queue instead, as orphaned files/chunks are removed automatically.

ravivgolov commented 4 weeks ago

I have only removed mail chunks that seemed to have been taken out of the queue.

It seems like removing the mail chunks is sufficient. Phew.

zone-mta> db["zone-queue"].countDocuments({}); 18 zone-mta>

louis-lau commented 4 weeks ago

Ah, seems there is some cleanup in place then if zonemta encounters a queued message without an associated file in gridfs. Nice!

ravivgolov commented 4 weeks ago

Thank God that exists, I need to develop a remove queue function in Zonemta admin that performs deletion by filter. How do you all handle sudden spam bombs?

louis-lau commented 4 weeks ago

Rate limits and reputation management in rspamd would be a good start...

You can also have automatic alerting etc. Standard stuff