Minimal Email Setup for Ghost 6.0 Docker Instance on Ubuntu?

I installed Ghost on an Ubuntu Linode 1 GB shared instance on Saturday. I installed it initially using ghost-cli and then migrated it to a Ghost 6.0 Docker-based install today. I am using the latest version. Now I noticed that I can’t log-in to my admin panel on a new device because email is not set up on my Linode instance and 2FA is required by default. I am aware that email is disabled on Linode by default to cut down on spam. I have opened a ticket with Linode to enable email.

Questions:

  • Are there any guides written for setting up email in such a way that it will be compatible with a Docker-based Ghost install? I am not looking to set up newsletter notifications and send email blasts. I just want to be able to log in!
  • Is there a sure-fire way to disable 2FA temporarily in production while I get email setup sorted?
  • How do I perform maintenance operations on a Dockerized Ghost instance? Since ghost-cli is not available, how could I run, for example, ghost doctor? How would I back-up a Dockerized Ghost instance?
  • Did I jump the gun and transition to Docker-based Ghost too soon? Should I have stayed with ghost-cli?

Thanks!

This post might help, last paragraph probably the quickest thing to try.

I have set up a Mailgun account, configured DNS for my site to support Mailgun, created an SMTP user, and used msmtp with a ~/.msmtprc file to verify that I can send email from that user. Email is being sent and received using msmtp.

This is my /opt/ghost/.env configuration for Dockerized Ghost:

mail__from=postmaster@example.com
mail__transport=SMTP
mail__options__host=smtp.mailgun.org
mail__options__port=587
mail__options__secure=false
mail__options__auth__user=postmaster@example.com
mail__options__auth__pass=MY_PASSWORD

I pasted the values of mail__from and mail__options__auth__pass directly into my msmtp config to make sure that there are no errors. I can successfully send emails using msmtp with these credentials.

However, when I try to log-in to my site, 2FA is active and an attempt to send an email fails with an error. Here is the error:

```
[2025-09-06 22:25:32] ERROR “POST /ghost/api/admin/session” 500 359ms

Failed to send email. Please check your site configuration and try again.

“Please see Configuration - Ghost Developer Docs for instructions on configuring email.”

Error ID:
66dec980-8b70-11f0-bff3-bb84e614fc69


EmailError: Failed to send email. Please check your site configuration and try again.
at Object.sendAuthCodeToUser (/var/lib/ghost/versions/6.0.7/core/server/services/auth/session/session-service.js:284:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Object.createSession (/var/lib/ghost/versions/6.0.7/core/server/services/auth/session/middleware.js:16:17)
```

Note that I have tried using the following configuration as well:

mail__options__port=465
mail__options__secure=true

This fails as well.

I just tried to ssh into my Ghost docker container:

sudo docker exec -it ghost-ghost-1 bash

I installed msmtp there and copied my .msmtprc file into /root/.msmtprcI was able to successfully send and receive an email using msmtp from inside my Ghost Docker container.

Finally figured it out!

When I imported my initial ghost-cli install the following got appended to the end of my .env file:

mail__transport=Direct

This overwrote the mail__transport=SMTP setting further up in my .env file and it broke my email configuration. I deleted this extra line of configuration and 2FA emails are working correctly now!

2 Likes