Sudden 429 (Bad Request) when sending magic link

When I use newsletter sign up form on my website I get an error:
Failed to load resource: the server responded with a status of 429 (Bad Request)

It broke around 15 of March. I’m not sure what triggered it. I did update the theme, but I didn’t modify scripts responsible for sending the link. It was a minor visual update.

Here is my config.production.json:


"url": "https://www.osintteam.com",
  "server": {
    "port": 2368,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "127.0.0.1",
      "user": "obfuscated_username",
      "password": "obfuscated_pass”,
      "port": 3306,
      "database": "obfuscated_database”
    }
  },
  "mail": {
    "transport": "SMTP",
    "options": {
      "service": "Mailgun",
      "host": "smtp.mailgun.org",
      "port": 465,
      "secure": true,
      "auth": {
        "user": "obfuscated_username",
        "pass": "obfuscated_pass"
      }
    },
    "from": "noreply@osintteam.com"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/www/ghost/content"
  }
}

I didn’t have "from": "noreply@osintteam.com" before, I added it because of the error in syslog file. It was:

[2025-04-02 14:56:17] #033[35mWARN#033[39m Missing mail.from config, falling back to a generated email address. Please update your config file and set a valid from address

However, it didn’t fix the issue. Then I tested Mailgun connectivity in terminal:

telnet smtp.mailgun.org 465

It stuck on Trying 34.160.157.95..., so I added a firewall rule:

sudo ufw allow out 465/tcp
sudo ufw allow out 587/tcp
sudo ufw allow out 25/tcp

It didn’t work. Still can’t connect using the aforementioned telnet command. By the way, here is a snippet from production.error.log:

{"name":"Log","hostname":"Ghost-blog","pid":3507902,"level":50,"version":"5.89.0","req":{"meta":{"requestId":"793d9542-6cf2-462f-9846-657170819921","userId":null},"url":"/send-magic-link/>

{"name":"Log","hostname":"Ghost-blog","pid":1217,"level":50,"version":"5.89.0","req":{"meta":{"requestId":"392274ab-f88b-4a0f-b94e-fe71d9aa09f4","userId":null},"url":"/send-magic-link/",">

Newsletter sending feature works fine. Emailed posts are delivered, only sign up feature is not working.

Any ideas how to fix the newsletter sending feature?

Your outgoing transactional email (sign-ups) go via SMTP, and I wonder if your host has blocked whatever port you’re using. (DO recently made some changes in this area.)

You might switch over to using the Mailgun API for outbound email - see this.

Thank you for the response!

I read that “host” field is only required if you are using SMTP instead of the API.

I used this snippet, but omitted the host field, like:

"mail": {
    "transport": "mailgun",
    "options": {
        "auth": {
            "api_key": "<>",
            "domain": "<>"
        }
    }
}

Is that the problem of 500 (Internal Server Error) I’m now getting?

"host" should be Mailgun’s SMTP server, and I’m using API, so the reason for 500 error should be something else.