# Self-hosted Ghost Instance Cannot Send E-mail with ERROR "POST /ghost/api/admin/session" 500

**URL:** <https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774>\
**Category:** Self-hosting\
**Created:** [November 4, 2025, 2:19pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774 "2025-11-04T14:19:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![yann-gael](https://avatars.discourse-cdn.com/v4/letter/y/dbc845/32.png) [@yann-gael](https://forum.ghost.org/u/yann-gael)\
**Post date:** [November 4, 2025, 2:19pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/1 "2025-11-04T14:19:03Z")

</div>

Hi,

I have installed a self-hosted instance of Ghost, running at [blog.ptidej.net](http://blog.ptidej.net). I had an old version (v4.48.9) running on Ubuntu v18.04 and moved its data to a new version (v6.6.0) running on Ubuntu v24.04. The migration went well except for sending e-mails. I used to use Gmail and copied/pasted the e-mail config. into the new instance as follows:

```auto
"mail": {
    "from": "blog@ptidej.net",
    "transport": "SMTP",
    "options": {
      "service": "Gmail",
      "host": "smtp.gmail.com",
      "port": 587,
      "auth": {
        "user": "<the username>",
        "pass": "<the password>"
      }
    }
  },

```

However, my instance still can’t send e-mails. Doing `ghost log` shows:

```auto
[2025-11-04 14:11:32] ERROR "POST /ghost/api/admin/session" 500 457ms

NAME: EmailError
CODE: ESOCKET
MESSAGE: Failed to send email. Please check your site configuration and try again.

level: normal

"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
EmailError: Failed to send email. Please check your site configuration and try again.
    at Object.sendAuthCodeToUser (/var/www/blog/versions/6.6.0/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/www/blog/versions/6.6.0/core/server/services/auth/session/middleware.js:16:17)

```

I don’t know why `/ghost/api/admin/session` wouldn’t be available and how to fix it.

Thanks in advance!  
Yann

---

<div class="post-metadata">

**Author:** ![yann-gael](https://avatars.discourse-cdn.com/v4/letter/y/dbc845/32.png) [@yann-gael](https://forum.ghost.org/u/yann-gael)\
**Post date:** [November 4, 2025, 2:21pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/2 "2025-11-04T14:21:44Z")

</div>

PS. This is what I see when I tried to log-in with `"staffDeviceVerification"`set to `true`.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/2/a/2a487e71f0c0e8f66d6cd2d0aa90ec8c19117ccd.png)

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [November 4, 2025, 4:11pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/3 "2025-11-04T16:11:08Z")

</div>

To get yourself logged in (quick fix, not long term solution), set staffDeviceVerification to false and restart Ghost.

There’s nothing wrong with your endpoint itself - the log right below shows that it can’t send email, which is why it’s throwing the 500 error.

Actual fix:

You need to get your transactional email sorted out, both so that you can have staff logins with device verification, and so that you can send magic link emails to your members.

Thoughts:

1. Some hosts block 587 and most/all SMTP ports. If you’re on Digital Ocean, this is 100% your problem, and it may be your problem on other hosts. (You might have to ask them.) Consider switching to the Mailgun API for transactional email. Here’s how:

> [@Missing documentation for mail config options – Mailgun API support](https://forum.ghost.org/t/missing-documentation-for-mail-config-options-mailgun-api-support/56481):
>
> I ran into some issues trying to set up transactional email with Ghost, and I think there’s a gap in the documentation that could use some clarification. I wanted to use Mailgun for sending transactional emails and followed the instructions here: I tried configuring SMTP as described, but it consistently timed out after 60 seconds (without any errors). I double-checked the ports, authentication details, and tried multiple variations without success. When I couldn’t get it working, I started …

1. I think you don’t want that service line. Here’s an example I used to use, before switching to the API approach:

> **[How to deliver Ghost emails from your local dev setup](https://www.spectralwebservices.com/blog/ghost-developer-email/)**
>
> How to get Ghost sending mail from your development install, without a whole lot of extra fuss.

1. Consider the possibility that you’re feeding Gmail the wrong password. It wants an app password, not your regular password. You may need to generate one.

---

<div class="post-metadata">

**Author:** ![yann-gael](https://avatars.discourse-cdn.com/v4/letter/y/dbc845/32.png) [@yann-gael](https://forum.ghost.org/u/yann-gael)\
**Post date:** [November 4, 2025, 7:36pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/4 "2025-11-04T19:36:00Z")

</div>

Hi Cathy,

Thanks for your swift answer!

I actually filled a ticket with DigitalOcean and they told me that my Droplet is not blocked because I already had one before they changed their policy.

I also temporarily disabled `ufw`. I’m sure that I’m using the right app. password from GMail. Still, Ghost couldn’t send an e-mail.

Is there other things that I could try? More log/verbosity?

Best,  
Yann

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [November 4, 2025, 8:05pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/5 "2025-11-04T20:05:41Z")

</div>

Start ghost form the console with ghost run -D for very spammy logging

---

<div class="post-metadata">

**Author:** ![yann-gael](https://avatars.discourse-cdn.com/v4/letter/y/dbc845/32.png) [@yann-gael](https://forum.ghost.org/u/yann-gael)\
**Post date:** [November 4, 2025, 10:39pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/6 "2025-11-04T22:39:32Z")

</div>

Hi Cathy!

> [@Cathy\_Sarisky](#):
>
> ghost run -D

Thanks, but I have another error now with `ghost run -D`:

```auto
The `ghost run` command is used by the configured Ghost process manager and for debugging. If you're not running this to debug something, you should run `ghost start` instead.
+ sudo node current/index.js
[2025-11-04 22:30:17] INFO Ghost is running in development...
[2025-11-04 22:30:17] INFO Listening on: 127.0.0.1:2368
[2025-11-04 22:30:17] INFO Url configured as: http://localhost:2368/
[2025-11-04 22:30:17] INFO Ctrl+C to shut down
[2025-11-04 22:30:17] INFO Ghost server started in 0.377s
[2025-11-04 22:30:17] ERROR SQLITE_CANTOPEN: unable to open database file

SQLITE_CANTOPEN: unable to open database file

"Unknown database error"

Error ID:
    500

Error Code:
    SQLITE_CANTOPEN

----------------------------------------

Error: SQLITE_CANTOPEN: unable to open database file
    at /var/www/blog/versions/6.6.0/node_modules/knex-migrator/lib/database.js:57:19

[2025-11-04 22:30:17] WARN Ghost is shutting down
[2025-11-04 22:30:17] WARN Ghost has shut down
[2025-11-04 22:30:17] WARN Ghost was running for a few seconds

```

I searched on the Internet but couldn’t find a solution to this error either ☹

In the meantime, I also tried, from my server, to connect manually to `smtp.google.com` using `openssl s_client -connect smtp.gmail.com:465 -crlf` and send a few emails, and I could send/receive these emails succesfully.

Thanks in advance!  
Yann

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [November 4, 2025, 10:43pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/7 "2025-11-04T22:43:06Z")

</div>

Oh, sorry, I think ghost run -D only runs development mode, and you probably need prod mode! Nevermind. 🙂

You might consider using something like [SWAKS](https://jetmore.org/john/code/swaks/) (frequent recommendation of @mjw ) for debugging the issue.

---

<div class="post-metadata">

**Author:** ![yann-gael](https://avatars.discourse-cdn.com/v4/letter/y/dbc845/32.png) [@yann-gael](https://forum.ghost.org/u/yann-gael)\
**Post date:** [November 5, 2025, 2:44am UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/8 "2025-11-05T02:44:45Z")

</div>

Hi Cathy!

Thanks, but (IIUC) SWAKS helps with debugging SMTP: I already know that I can send emails manually. It’s Ghost that doesn’t succeed in sending emails, even though (AFAIK) I used the exact same configuration for manual sending and for Ghost.

Is there no way to have more detailed logs?

Best,  
Yann

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [November 5, 2025, 3:23am UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/9 "2025-11-05T03:23:30Z")

</div>

> **[Configuration - Ghost Developer Docs](https://docs.ghost.org/config)**
>
> For self-hosted Ghost users, a custom configuration file can be used to override Ghost’s default behaviour. This provides you with a range of options to configure your publication to suit your needs.

It’s possible to setting the logging level. I suspect that debug is a valid value but don’t see it in the docs.

I wonder if Google doesn’t like the from address Ghost is using?

---

<div class="post-metadata">

**Author:** ![ghostdan](https://avatars.discourse-cdn.com/v4/letter/g/ea5d25/32.png) [@ghostdan](https://forum.ghost.org/u/ghostdan)\
**Post date:** [November 5, 2025, 12:15pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/10 "2025-11-05T12:15:00Z")

</div>

The MX records for your domain [ptidej.net](http://ptidej.net) aren’t pointed to Google Workplace. Is your from email address [blog@ptidej.net](mailto:blog@ptidej.net) even hosted on Google? If not, trying to send through Google’s SMTP server doesn’t seem like it would work.

---

<div class="post-metadata">

**Author:** ![yann-gael](https://avatars.discourse-cdn.com/v4/letter/y/dbc845/32.png) [@yann-gael](https://forum.ghost.org/u/yann-gael)\
**Post date:** [November 5, 2025, 1:19pm UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/11 "2025-11-05T13:19:07Z")

</div>

Hi Ghostdan,

Thanks for your reply, but my problem is not with Google SMTP server. As I wrote, from my server on DigitalOcean, I can send e-mails through [smtp.google.com](http://smtp.google.com) just fine, manually. It’s Ghost, running on the _same_ server, that can’t, and I’m trying to solve that problem.

Are there ways to debug what Ghost tries to do when sending an e-mail?

Best,  
Yann

---

<div class="post-metadata">

**Author:** ![Cue](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cue/32/38224_2.png) [@Cue](https://forum.ghost.org/u/Cue)\
**Post date:** [November 6, 2025, 1:28am UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/12 "2025-11-06T01:28:07Z")

</div>

Yann,

I’m confused, are you trying to configure bulk email, or transactional email?

The newer versions of Ghost are pretty clear, the only supported bulk mail API is mailgun.

> **[Why do I have to set up Mailgun? - Ghost Developer Docs](https://docs.ghost.org/faq/mailgun-newsletters)**
>
> Ghost has the ability to deliver posts as email newsletters natively. A bulk-mail provider is required to use this feature and SMTP cannot be used.

---

<div class="post-metadata">

**Author:** ![yann-gael](https://avatars.discourse-cdn.com/v4/letter/y/dbc845/32.png) [@yann-gael](https://forum.ghost.org/u/yann-gael)\
**Post date:** [November 6, 2025, 3:50am UTC](https://forum.ghost.org/t/self-hosted-ghost-instance-cannot-send-e-mail-with-error-post-ghost-api-admin-session-500/60774/13 "2025-11-06T03:50:58Z")

</div>

Hi all,

Just wanted to thank you all for your help, it works now: after DigitalOcean did reset the network interface of my Droplet and I rebooted it, Ghost can now successfully send (transactional) e-mails 🙂.

Best!  
Yann
