500 mail error when trying to log in to a local ghost site

Hi Friends,

I’m trying to fix a 500 error with locally running Ghost sites not sending email. I’ve tried the usual SMTP setup and the api_key setup. All fail. I’ve tried every combination of settings in every thread, post, or article I can find on the subject.

Environment:

  • Mac OS 15.5
  • Ghost 5.129.1
  • DB: SQLite
  • Browser: Chrome

Reproduction:

  • Install ghost locally
  • Add mail settings to config.development.json
  • Restart ghost
  • Go to /ghost to setup an account.
  • Poke around.
  • Log out.
  • Try logging back in.

The purpose of the local setup is to work on themes locally first before pushing them to a server, but after a day I’m logged out of new ghost installs, and logging in doesn’t work. I receive a generic Email error advising me to check my email settings.

Here is the relevant part of the log:

{
  "res":{
    "_headers":{
      "x-powered-by":"Express",
      "content-version":"v5.129",
      "vary":"Accept-Version,
      Origin,
      Accept-Encoding",
      "cache-control":"no-cache,
      private,
      no-store,
      must-revalidate,
      max-stale=0,
      post-check=0,
      pre-check=0",
      "access-control-allow-origin":"http://localhost:2371",
      "content-type":"application/json; charset=utf-8",
      "content-length":"339",
      "etag":"W/\"153-el4fja4K+S2Gx8dnKS2IDfdCyRM\""
    },
    "statusCode":500,
    "responseTime":"138ms"
  },
  "err":{
    "id":"2bf9b580-5dbe-11f0-b5b5-4b6fff9962f1",
    "domain":"http://localhost:2371/",
    "code":null,
    "name":"EmailError",
    "statusCode":500,
    "level":"normal",
    "message":"Failed to send email. Please check your site configuration and try again.",
    "help":"\"Please see https://ghost.org/docs/config/#mail for instructions on configuring email.\"",
    "stack":"EmailError: Failed to send email. Please check your site configuration and try again.\n    at Object.sendAuthCodeToUser (/Users/karlweber/sites/kowfm/versions/5.129.1/core/server/services/auth/session/session-service.js:284:19)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async Object.createSession (/Users/karlweber/sites/kowfm/versions/5.129.1/core/server/services/auth/session/middleware.js:16:17)",
    "hideStack":false
  },
  "msg":"Failed to send email. Please check your site configuration and try again.",
  "time":"2025-07-10T18:46:21.145Z",
  "v":0
}

Any help would be much appreciated friends. Thanks.

-kow

Can you share your config.development.json with us (redacting sensitive information, such as passwords, of course)?

Also, if you just need the mail config for logging in with the new device verification, you can disable that: ghost.org/docs/config/#security

1 Like

I’ll try that to see if I can bypass the email verification. But in case it doesn’t work I’ll post my config:

{
  "url": "http://localhost:2371/",
  "server": {
    "port": 2371,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "sqlite3",
    "connection": {
      "filename": "/Users/karlweber/sites/kowfm/content/data/ghost-dev.db"
    }
  },
  "mail": {
    "transport": "mailgun",
    "options": {
      "host": "api.mailgun.net",
      "auth": {
        "api_key": "gibberish",
        "domain": "mail.kow.fm"
      }
    }
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "local",
  "paths": {
    "contentPath": "/Users/karlweber/sites/kowfm/content"
  }
}

So I’ve bypassed the security feature with this, so functionally it works. But I’m going to dig in later to understand the mail issues.

Any chance you’re on Mailgun’s EU servers? Then the mail.options.host would be api.eu.mailgun.net.

Mailgun is sometimes persnickety about emails coming from localhost. Your ISP might also be blocking you. If you’re just testing locally, I recommend maildev. It puts up a fake smtp server that runs on your local machine, traps any outbound email from your ghost site, and gives you a web interface where you can see it. Super good for testing email behavior, without actually having to get some service to accept email.

2 Likes

I’m using the US servers, so this isn’t an issue yet.

I’ll try this! Thanks so much Cathy.