I\'m using Mailgun for a site I maintain, usually Mailgun works great, but I am encountering a strange problem. My script calls the HTTP API to send messages using Mailgun, thes
If this is happening regularly, it is very likely Mailgun has you on one of their low-tier IP addresses. I imagine this is the default for free accounts, since they don't want to "pollute" their good addresses with new users who may not be serious / legit.
You can check the "quality" of the IP address at a site like Sender Score. Find this line in the Mailgun log of a delivered message:
"sending-ip": "XXX.XX.XXX.XXX"
If Sender Score shows a score in the 70s, that's your problem. Send Mailgun a support ticket, as Chris suggested, and see if they can get you onto a higher quality IP address. I did so and my emails are now being sent from an IP address with a score in the 90s. Haven't had a single delay since.