R
Railway3mo ago
pearcy

Ghost CMS email config

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: mg.domain.com 2. DNS Configuration: - Added MX, TXT, and CNAME records to my Namecheap registrar. 3. DNS Check & Verification: - All records passed DNS checks and are verified in Mailgun. 4. 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="[email protected]"
mail__auth__pass="hidden"
mail__from="[email protected]"

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="[email protected]"
mail__auth__pass="hidden"
mail__from="[email protected]"

Reference: https://ghost.org/docs/config/ 5. 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
OK
08/27/24, 1:01:55 PM Accepted

08/27/24, 1:01:59 PM Delivered
OK
08/27/24, 1:01:55 PM Accepted

#### 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.
Ghost - The Professional Publishing Platform
Configuration - Adapt your publication to suit your needs
Find out how to configure your Ghost publication or override Ghost's default behaviour with robust config options, including mail, storage, scheduling and more!
2 Replies
Percy
Percy3mo ago
Project ID: 71b92ac0-afb1-4da1-af80-1cc0780f0330
pearcy
pearcy2mo ago
71b92ac0-afb1-4da1-af80-1cc0780f0330 Further testing and logs: I am able to send newsletters (bulk emails) from the Ghost CMS admin panel to myself, confirming that the bulk email functionality is working as expected. However, I am unable to: -- Use the "Forgot Password" functionality. -- Sign up for the newsletter via the front-end form. 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://domain.com/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)
[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)
2. Sign Up for Newsletter Issue: When trying to sign up for a newsletter via the front-end form on Ghost CMS, the system fails to send the confirmation email, resulting in a 500 Internal Server Error. Frontend Error Message: "Failed to load resource: the server responded with a status of 500 () /members/api/send-magic-link/:1" Railway Logs:
[2024-08-27 18:14:19] WARN Request with missing integrity token.

[2024-08-27 18:14:19] ERROR "POST /members/api/send-magic-link/" 500 142ms

Failed to send email. Reason: connect ECONNREFUSED ::1:587.

Error ID: 2d6ce170-64a0-11ef-bfeb-ffe94e1b5f69
Error Code: ESOCKET

Error: connect ECONNREFUSED ::1:587
at createMailError (/var/lib/ghost/versions/5.90.0/core/server/services/mail/GhostMailer.js:105:12)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
[2024-08-27 18:14:19] WARN Request with missing integrity token.

[2024-08-27 18:14:19] ERROR "POST /members/api/send-magic-link/" 500 142ms

Failed to send email. Reason: connect ECONNREFUSED ::1:587.

Error ID: 2d6ce170-64a0-11ef-bfeb-ffe94e1b5f69
Error Code: ESOCKET

Error: connect ECONNREFUSED ::1:587
at createMailError (/var/lib/ghost/versions/5.90.0/core/server/services/mail/GhostMailer.js:105:12)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
Want results from more Discord servers?
Add your server