Mailgun problems, despite following step by step

I keep getting an error when sending Invite People in Ghost Dashboard.

-received email from Mailgun confirming that they verified domain

Error: “Request was rejected due to server error” on Ghost Invite people dashboard

Mailgun SMTP credentials:

Domain: mail.factnest.com
Login: postmaster@mail.factnest.com
password: copy and pasted into “config.production.json”
SMTP settings: smtp.mailgun.org
Our servers listen on ports 25 , 587 , and 465 (SSL/TLS)

config.production.json

“mail”: {
“transport”: “SMTP”,
“options”: {
“service”: “Mailgun”,
“host”: “smtp.mailgun.org”,
“secure”: true,
“port”: 587,
“auth”: {
“user”: “postmaster@mail.factnest.com”,
“pass”: “password_copy_and_pasted_from_mailgun”
}
}
},

$ ghost restart ( no error )

I’ve also tried:

“secure”: false,
No secure field

$ ghost restart ( no error, site up and running, just keep getting the email error)

Mailgun recommends that we recreate a subdomain, so I created mail.factnest.com . I don’t have an SSL certificate for the subdomain. Does it matter? Has anyone used Mailgun and NOT used a subdomain as they recommended?

Any help would be appreciated.

I think I may know what the issue is: Mailgun recommends that we create a subdomain for the mail service. So, we also need to create a new A/AAAA record for the mail subdomain.

Mailgun domain: mailgun.mydomain.com

  1. Add new A/AAAA DNS record with Host or Registrar: mailgun.mydomain.com

  2. Because we’ve added a new DNS record, wait about 24 hours for the DNS record to propagate.

  3. If using ufw firewall: $ sudo ufw allow 587

  4. In Ghost Email dashboard, enter the PRIVATE API key found in Mailgun Settings ( not Sending)–not the Nodejs API key.

I’ll update this in a few days to see if it works.

Sounds like you’ve got a few issues laid on top of each other that need to be sorted out one by one.

Go back to the original configuration after following the instructions step by step. Don’t forget the original instruction were added to recently to use "secure": false,. I’m not sure why Ghost even ran when you had "secure" "true",. That’s not correct syntax so it should have failed.

Now what’s the error? The “fixes” you’re applying might be causing more problems than they’re fixing.

The dedicated subdomain for mailgun is a good idea. I don’t see why you wouldn’t do it. There’s essentially no additional steps. It sounds like you’ve configured two now - mail and mailgun. Just stick to mailgun because mail is typically already used for default services.

You definitely don’t need an A/AAAA record. Just follow the instructions to create the TXT, MX and CNAME records. Mailgun will check that you’ve done it all right. Do you have all green ticks in mailgun → sending → domains → domain settings → DNS records?

You definitely don’t need to change your firewall - the connect to mailgun is outbound so poking a hole in your own firewall is a bad idea.

You definitely don’t need an SSL certificate for the domain.

So if you just follow the instructions, what error do you get?

Thanks for the clarification. I’ll implement your suggestions and get back to you.

I deleted mail. because I also configured iCloud+ MX records and thought they were conflicting. So I started over again, and will do one thing at a time.

It’s been a great learning experience this week!

config.production.json

“mail”: {
“transport”: “SMTP”,
“options”: {
“service”: “Mailgun”,
“host”: “smtp.mailgun.org”,
“port”: 587,
“secure”: false,
“auth”: {
“user”: “postmaster@mailgun.factnest.com”,
“pass”: “copy_pasted_mailgun_password”
}
}
},

Linode DNS settings

$ ghost restart ( no error )
$ sudo service nginx restart ( no error, site up )

Invite People in dashboard. Takes a long time, then error.

Screen Shot 2021-09-30 at 6.40.51 PM

I’ll wait 24 hours and try again because I tried doing everything at once with Mailgun and iCloud+, so there could be conflicting issues. I deleted the iCloud+ DNS mail records and will re-add if Mailgun works first.

I added myself as a member. Published two test posts and it sent them to my email accounts. Mailgun is working with API key.

However, when I Invite People in Staff, I get the error “Request was rejected due to server error.”

I’ll wait for another 12 hours to see if it isn’t a DNS propagation issue.

I checked with my VPS Linode and found this piece of information:

1 Like

There were several possible errors in the chain:

–Ghost
–Server setup
–DNS records haven’t propagated
–VPS provider Linode
–Me making errors, as usual lol

It turns out that it was Linode’s restriction on ports 25, 465, and 587. I sent them a support ticket and they opened port 587. It works now!

Thanks for all your help! God bless.

1 Like

On my setup,
“secure”: false ( works)
“secure”: true (doesn’t work )