Mailgun suddenly stopped working

My site uses mailgun via the API for bulk emails as recommended in the ghost setup. It has been working fine all this while, but today I get this error

I logged into mailgun and everything seems to be fine there. The mailgun settings in the ghost admin are also fine. Transactional emails via mailgun are still working.

I had upgraded to Ghost 5 before this and I am wondering if something changed in the new version.

Where can I find more about the error? Is it unable to connect to mailgun? Is it a problem with the API key?

I am self hosted on Digital Ocean if that helps.

What steps did you take to upgrade?

Also, try a test post, and just select yourself for email, to rule out a temporary outage.

I did the upgrade on the command line, the command was ghost upgrade I think. I had to do it in two steps, first to upgrade to the latest 4.x and then to 5.

I created a test post as you suggested sent it to myself and the email worked. Not sure how :astonished:

Maybe it was a temporary error.

Is there a way I can go to the previous post and send out the email? I tried to unpublish it and publish it again but ghost says that it has already sent the email and does not show any option to send the email again.

You could recreate the post, delete the original, then change the slug on the new post to match the original, before publication.

So very strange behaviour. I recreated the post and its not sending again. I immediately created a test post and that went through. So it is not any temporary issue on mailgun’s side.

I wonder if it has something to do with the content of this particular post? I wish I could see the exact error message.

This is the article in question which is not going through:

I did a few more experiments. The full article is sent out when I send it to my two test email addresses. I then tried sending it out to the whole list and it’s not working. So it is not anything to do with the article contents or mailgun settings.

There is some error being generated when sending out to the list. Any idea if there are any logs being stored anywhere?

I think it may be helpful to share details of your setup, including OS, Node, ghost-cli versions etc. In addition, what DO droplet size do you use?

Finally, is transactional email sent via Mailgun?

Yes, transactional email (via SMTP) works. Also bulk mail via the API to the test addresses works.

This is a 2 GB memory & 25 GB disk droplet.

OS is Ubuntu 20.04 LTS, Node v 16, ghost-cli is v1.19 and ghost version is 5.2.3

Does mailgun have any limits on the number of users you can send a single bulk email to? I am on the free (foundation) plan on mailgun which if I understand correctly should allow 6000 emails a month.

One more data point. I re-published the article and selected 9 people to send to and the email went through successfully. When I make it 10 or more, then it gives an error. I suspect something happens when it is 10 or more?

I’m wondering now if mailgun has a limit on number of recipients on the free plan.

There’s a 5,000 email limit on the free trial*, but if it’s a new account, they may apply a rate limit, although I thought that was set to 100.

Things to check…

  • The api matches your region
  • Use Curl to send test messages through the API, see the response codes etc.
  • Reach out to Mailgun support; I found them very responsive when first setting up Ghost

*You’re not billed for under 1,000 PCM, and then $1.00 per 1,000 emails. I’m pretty sure you provide payment details when signing-up.

I reached out to mailgun support and they said that the account was restricted. They lifted the restriction and everything is fine now. Thanks for all the help @mjw

Though I wish Ghost gave a better error message than “Service is currently unavailable”. At least if it said that the mailgun api was returning an error, then it would be a lot easier to find out the issue

1 Like

I think this is all Ghost has returned from Mailgun.

Good to learn you’ve got it sorted now, and thanks for updating the thread.