Help with email subs via mailgun

Hi there,

I’ve gotten memberships up and running, successfully hooked up to Stripe and Mailgun. I’ve tested a paid subscription and it works. I was also able to successfully sign up for a paid subscription with a corporate email address I own. I successfully received the sign in link email, as well as a test post email. My Mailgun is connected via API and set up via a subdomain (

However, when trying to subscribe with another test gmail address, I get the message “Please enter a valid email address!”

Platform: Ghost 3.2 on digitalocean droplet, + cloudflare
Theme: Lyra (also tried Pico, same issue)
Member settings: Both free and paid set up
Email type not working: Cannot input gmail addresses for signup
Email config: Mailgun,, API connection


1 Like

I’ve seen this also when using a * address on, so there’s a bug somewhere.

Btw the “Please enter a valid email address!” message is hard-coded into the theme. This bug may be something totally unrelated.

For any of the Ghost team, here is the response in the console from the POST to

{"errors":[{"message":"Resource not found","context":null,"type":"NotFoundError","details":null,"property":null,"help":null,"code":null,"id":"66fb1b30-b056-11ea-9f8f-db7cad8affec"}]}

Is it specifically gmail emails that aren’t working? Leads me to believe it’s some sort of spam protection in Mailgun :thinking:

It actually worked with a yahoo account, but the message also went to spam.

Here’s my error log for the gmail address:

[2020-06-17 15:56:20] INFO “POST /members/api/send-magic-link/” 500 434ms
[2020-06-17 16:02:05] ERROR

NAME: EmailError
MESSAGE: Failed to send email.

level: normal

“Please see Configuration - Adapt your publication to suit your needs for instructions on configuring email.”
EmailError: Failed to send email.
at EmailError.GhostError (/var/www/ghost/versions/3.20.0/node_modules/@tryghost/errors/lib/errors.js:10:26)
at new EmailError (/var/www/ghost/versions/3.20.0/node_modules/@tryghost/errors/lib/errors.js:34:20)
at createMailError (/var/www/ghost/versions/3.20.0/core/server/services/mail/GhostMailer.js:51:12)
at EventEmitter. (/var/www/ghost/versions/3.20.0/core/server/services/mail/GhostMailer.js:112:24)
at Object.onceWrapper (events.js:422:26)
at EventEmitter.emit (events.js:315:20)
at EventEmitter.emit (domain.js:482:12)
at DirectMailer. (/var/www/ghost/versions/3.20.0/node_modules/directmail/lib/mailer.js:174:38)
at SMTPClient. (/var/www/ghost/versions/3.20.0/node_modules/directmail/lib/mailer.js:292:13)
at Object.onceWrapper (events.js:421:28)
at SMTPClient.emit (events.js:315:20)
at SMTPClient.EventEmitter.emit (domain.js:482:12)
at SMTPClient._destroy (/var/www/ghost/versions/3.20.0/node_modules/simplesmtp/lib/client.js:310:10)
at SMTPClient._onEnd (/var/www/ghost/versions/3.20.0/node_modules/simplesmtp/lib/client.js:410:10)
at Socket.emit (events.js:327:22)
at Socket.EventEmitter.emit (domain.js:482:12)
at endReadableNT (_stream_readable.js:1221:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)

[2020-06-17 16:02:05] INFO “POST /members/api/send-magic-link/” 500 335ms

I’ve also been struggling with this issue a lot on the Perfect Product blog.

Can’t signup with addresses. Outputs the same glitch you’ve mentioned above:

Reaching out to Mailgun customer support hasn’t been much help either because my google domains DNS seetings and mailgun email settings are correct according to both companies documentation.

Not very fun when I can literally learn how to develop software products more easily than solve my blog’s glitch adding new subscribers.

Edit: I solved this issue by following the instructions in this thread: Ghost 3.1 Can't get Mailgun & Member signup working on my Ghost install


  1. Add spf entry to your domain (not sure if this is strictly necessary, but the subscription email did come to my Primary gmail box, so seems promising. Just add this TXT record to your domain: v=spf1 ~all
  2. Edit your config.production.json file to include Mailgun SMTP settings
    • See screenshot
    • Note that this is still necessary even if you set up Mailgun API access via the Ghost GUI. My understanding is that the Mailgun API is used for bulk newsletter sends, and you need the SMTP setup for transactional emails (ie staff emails, forgotten password emails, and member signup/signin emails)
    • Your config file is located with your ghost install, in my case /var/www/ghost. You can edit it with vim or nano
    • Note that I am using a subdomain to send emails, not sure if this matters
  3. Run ghost restart and everything should work!

h/t @dsecareanu for the helpful solution



Hi @morgan or anyone else that can reply.

  1. I added the TXT(and MX and CNAME) records to my (digitalocean) domain. Waiting for verification

  2. I’m not used to add code, change stuff…I’m happy I got this far(ghost running on digital ocean through cloudflare) BUT I really want to solve this now I’m this close.

So my question is: how do I get in my ghost install and what do I do after that?

For yourself or anybody else, thanks for reading and hopefully helping me out.