ChildOfCode


Code, Maker, Robotic, Open Source. Knowledge Bases


Ghost CMS - Invited Users Error sending email! Solution

Error sending email! Error sending email: Failed to send email.Please check your email settings and resend the invitation.

I set up a New Ghost Blog website for other activities on DigitalOcean VPS Hosting Droplet. After setting up and using it for a period of time, we need to add a new Staff user to help maintain the Blog, but when clicking "Invite", people always encounter the "Error sending email" problem.

First, I tried to set up Postfix to send invitations, but after setting up, I tried to send emails, and we received a new error.

This message does not have authentication information or fails to 550-5.7.26 pass authentication checks. To best protect our users from spam, the 550-5.7.26 message has been blocked. Please visit 550-5.7.26 https://support.google.com/mail/answer/81126#authentication for more 550 5.7.26 information.

It looks like on DigitalOcean server, use Postfix to send emails, need to set up SPF records for the target recipient, if recipient is use gmail.

Updating SPF records on DigitalOcean servers is easy. But this method seems to take some time to update SPF Record.
https://www.digitalocean.com/community/tutorials/how-to-create-a-spf-record-for-your-domain-with-google-apps

In our case, we needed a quick solution to solve, so we found a better way is to use Mailgun service, because we don't need to register many users, only need to add 2 users to maintain the blog. Mailgun free plan can accommodate up to 5 authorized recipients who have not keyed in a credit card, that is enough for our situation.

First, you need to go to https://www.mailgun.com to register an account, please remember to check your email to verify Mailgun.

After logging into Mailgun, you need to obtain SMTP credentials and add authorized recipients.
If you are a paying user or put a credit card on Mailgun, you can skill the "authorize recipient" step, otherwise you will need to perform this step because on the Free plan without credit card information present or using your sandbox domain for testing, you're restricted to sending just to Authorized Recipients.

1) Get SMTP credentials info

Go to "Sending" > "Overview" > Click on "SMTP" Select button. save the SMTP credentials info.

2) Add Authorized Recipients

On the same page, scroll down the "Authorized Recipients" section and add the destination email address. After adding the email, Mailgun will send a verification email to the email address, owner of the email needs to be verified to allow Mailgun to send the email, otherwise you will not be able to send the email to the target email address.

After completing the installation on Mailgun, now we need to configure Ghost CMS.

Go to your Ghost CMS folder on the server and find the file config.production.json, we need to add credentials.

3) Add Mailgun credentials on config.production.json

Add email credentials on config.production.json Replace the "user" and "pass" values with your Mailgun SMTP credential information.

"mail": {
    "transport": "SMTP",
    "options": {
      "service": "Mailgun",
      "host": "smtp.mailgun.org",
      "port": 587,
      "secureConnection": false,
      "auth": {
        "user": "postmaster@sandboxe123456789abcdefg.mailgun.org",
        "pass": "123456789abcdefghi"
      }
    }
  }

When finished, go to the server terminal and restart Ghost CMS with the following command.
ghost restart

You should able to send invitation emails now. enjoy.

Software version

DigitalOcean VPS Hosting
Ubuntu - 18.04.4 LTS
NodeJS - v12.18.0
Ghost CMS - 3.36

Signs up with below DigitalOcean referral link you will gets $100, 60-day credit now! Get a try on DigitalOcean to create your server or application. https://m.do.co/c/6ca3326e1aa6