I had to move Ghost to a new server today, and upgraded to the latest Ghost 6 (6.39.0) at the same time. I imported my posts, manually re-added comments (these don’t appear to be included in the backup). Next I configured Mailgun. The blog is working for the most part.
When writing a post I can successfully email myself a preview of the post. Unfortunately, user signups, sending a magic link to login, and sending administrator 2FA codes is failing.
Comparing my old and new server, there is no SMTP configuration in config.production.json in either case. My old server was running Ghost 5.
When attempting to send a magic link for sign in I receive the error “Failed to log in, please try again”.
Running ghost log shows me:
[2026-05-20 16:40:16] ERROR "POST /members/api/send-magic-link/" 500 117ms
NAME: EmailError
CODE: ESOCKET
MESSAGE: Failed to send email. Reason: connect ECONNREFUSED ::1:587.
level: normal
"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
Error: connect ECONNREFUSED ::1:587
at createMailError (/var/www/jonsdocs/www/versions/6.39.0/core/server/services/mail/ghost-mailer.js:90:12)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1637:16)
I am unclear why sending magic links and 2FA codes is not being sent via the configured (and working) Mailgun configuration. There is no SMTP server running on my host, nor was there on the previous host.
Could anybody point me in the correct direction please?
Platform information
- Ubuntu 24.04
- Mysql Ver 8.0.45-0ubuntu0.24.04.1 for Linux on x86_64 ((Ubuntu))
- Node 22
Ghost doctor output
Debug Information:
OS: Ubuntu, v24.04.4 LTS
Node Version: v22.22.2
Ghost Version: 6.39.0
Ghost-CLI Version: 1.29.3
Environment: production
Command: 'ghost doctor'
✔ Checking system Node.js version - found v22.22.2
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking system compatibility
✔ Checking for a MySQL installation
+ sudo systemctl is-active ghost_blog-jonsdocs-org-uk
✔ Validating config
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability
✔ Checking binary dependencies
✔ Checking free space
✔ Checking systemd unit file
✔ Checking systemd node version - found v22.22.2
Other posts
I’m aware of Failing to setup SMTP from 2023 but that does have configuration in the JSON file. As my previous (working) instance did not have that configuration I’ve not made any changes to the JSON configuration at this stage.
Many thanks in advance.