Ghost CMS email config

pearcyHOBBY

8 months ago

I’m running into an issue with Ghost CMS where users are unable to sign up for my newsletter due to an email configuration problem. Here’s the setup and what I’ve tried so far:

Steps Taken:

  1. Created Subdomain in Mailgun:

  • Subdomain: email.watchy.tv

  1. DNS Configuration:

  • Added MX, TXT, and CNAME records to my Namecheap registrar.

  1. DNS Check & Verification:

  • All records passed DNS checks and are verified in Mailgun.

  1. Email Configuration in Railway:

  • I added the email settings as Railway environment variables instead of using config.production.json (I don’t believe I have access to the config file due to deployment via a Railway Docker image).

    Environment Variables:

   mail__transport="SMTP"
   mail__options__service="Mailgun"
   mail__options__host="smtp.mailgun.org"
   mail__options__port="587"  # also tried "465" for SSL/TLS
   mail__options__secure="false"  # "true" if using port 465
   mail__auth__user="postmaster@email.watchy.tv"
   mail__auth__pass="775dfhiddenpasswordcredentials"
   mail__from="postmaster@email.watchy.tv"

Reference:
https://ghost.org/docs/config/

  1. Mailgun Configuration Verification:

  • I used swaks to confirm that my Mailgun SMTP settings are correct.

  • A test email was successfully sent and received via my terminal.

    Mailgun Logs:

   08/27/24, 1:01:59 PM    Delivered    
   postmaster@email.watchy.tv
   testuser@gmail.com
   OK
   08/27/24, 1:01:55 PM    Accepted    
   postmaster@email.watchy.tv
   testuser@gmail.com

Question:

  • Is using environment variables in Railway instead of config.production.json a workable approach for Ghost CMS email configuration?

Any insights or suggestions would be greatly appreciated.

0 Replies

pearcyHOBBY

8 months ago

71b92ac0-afb1-4da1-af80-1cc0780f0330


pearcyHOBBY

8 months ago

I was able to send a newsletter (from admin) but not able to sign up for a newsletter or use forget password on the front end.


pearcyHOBBY

8 months ago

Summary of Error Messages for Ghost CMS Email Issues

  1. Forgot Password
    Issue:
    When attempting to reset a password via the "Forgot Password" feature, the email fails to send, resulting in the following error message:
    Frontend Error Message:

"Failed to send email. Reason: Can't send mail - all recipients were rejected: 550 5.7.1 Relaying denied."
Console Error:

POST https://watchy.tv/ghost/api/admin/authentication/password_reset/ 500 (Internal Server Error)
Railway Logs:

[2024-08-27 23:08:53] ERROR "POST /ghost/api/admin/authentication/password_reset/" 500 832ms

Failed to send email. Reason: Can't send mail - all recipients were rejected: 550 5.7.1 Relaying denied.

Error ID: 545fe6f0-64c9-11ef-bee5-a303e750d0e7
Error Code: EENVELOPE

Error: Can't send mail - all recipients were rejected: 550 5.7.1 Relaying denied
    at createMailError (/var/lib/ghost/versions/5.90.0/core/server/services/mail/GhostMailer.js:105:12)
    at SMTPConnection._formatError (/var/lib/ghost/versions/5.90.0/node_modules/nodemailer/lib/smtp-connection/index.js:798:19)
    at SMTPConnection._actionRCPT (/var/lib/ghost/versions/5.90.0/node_modules/nodemailer/lib/smtp-connection/index.js:1667:28)

pearcyHOBBY

8 months ago

  1. Sign Up for Newsletter
    Issue:

When users attempt to sign up for the newsletter via the front-end form, emails are not being accepted or sent correctly.
Frontend Error Message:

"Failed to send email. Reason: Can't send mail - all recipients were rejected: 550 5.7.1 Relaying denied."
Console Error:

POST https://watchy.tv/members/api/send-magic-link/ 400 (Bad Request)
Railway Logs:

[2024-08-27 20:08:53] ERROR Failed to send email. Reason: Can't send mail - all recipients were rejected: 550 5.7.1 Relaying denied.

Error ID: 2ebdff40-64b0-11ef-8ed3-533c6d1551fe
Error Code: EENVELOPE

Error: Can't send mail - all recipients were rejected: 550 5.7.1 Relaying denied
    at createMailError (/var/lib/ghost/versions/5.90.0/core/server/services/mail/GhostMailer.js:105:12)
    at SMTPConnection._formatError (/var/lib/ghost/versions/5.90.0/node_modules/nodemailer/lib/smtp-connection/index.js:798:19)
    at SMTPConnection._actionRCPT (/var/lib/ghost/versions/5.90.0/node_modules/nodemailer/lib/smtp-connection/index.js:1667:28)

Ghost CMS email config - Railway Help Station