I am using mailgun API to send emails. By mistake I called a function that queued thousands of emails in Mailgun.
Is there a way to Cancel/Clear the queue?
I am using mailgun API to send emails. By mistake I called a function that queued thousands of emails in Mailgun.
Is there a way to Cancel/Clear the queue?
There does not seem to exist an easy way through the API, except contacting Mailgun Support.
On the other hand, I found a handy workaround that might work for your case: add the recipients in the Bounced Recipients temporarily (Suppressions) so when the time comes, email will not be sent and marked as failed/bounced from Mailgun.
When all of the emails you wanted disappeared are marked as bounced, you can remove recipients from bounces list.
Hope this helps
ps: I know it's an old thread but, mistakes are made all the time ;)
If I've sent an email to 150 recipients to the mailgun servers and used BatchMessage and setDeliveryTime() to schedule it for the next day at 7 AM, there's currently no way to cancel this message if I decide later, before the set time, to cancel the job.
This could be fixed by getting a return hash value when using finalize() which then could be used with a new function deleteMessageQueue(return hash value) that will cancel the job.
The canceled message still counts the email credits used, of course.
rather than Bouncing the address, you can tag your emails and then just unsubscribe the address from the specific tag.
It's 2024 and you can purge the queue, look at MailGun API documentation
I have been calling this API endpoint like below:
curl -i -X DELETE --user 'api:<api key>' https://storage-us-east4.api.mailgun.net/v3/mail.superbly.cloud/envelopes
storage-us-east4.api.mailgun.net
is address that depends on your region.
© 2022 - 2025 — McMap. All rights reserved.