My site is up and running. Everything including sending newsletter emails and signing in works. The only issue I am having is when I try to put in another email address of mine to test if the subscribe option works on my site. Everytime I input an email into subscribe, an error comes up saying “Failed to send magic link email”. I checked Mailgun and my config production file and there is nothing wrong. I set it up correctly as suggested online. I am not sure how can I troubleshoot the error.
I tried what was suggested but it does not seem to have worked and now I am getting another error when I try to input the same email to test out subscribe: “Too many different sign-in attempts try again in 15 minutes”. I will wait the 15 minutes and retry again then end up with the same exact error. I tried to use ghost doctor and ghost logs and I can’t seem to find what the issue is. I checked the logs in mailgun and it seems to be working completely fine. I also tried a different email address and still ended up with the same error.
This isn’t an error message; Ghost blocks repeated login attempts. Furthermore, after changing the configuration file, you need to execute ghost restart.
You should also check that you haven’t blocked port 587 in your firewall. You can test using telnet server.domain.com 587.
With every change to the config file, I restarted ghost and tried again. I just checked to see if the port 587 is blocked in the firewall and this is what I got:
ghost-mgr@username:/var/www/ghost$ telnet server.domain.com 587
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
If this means that the port is blocked how would I be able to unblock it in the firewall?
I’d check your credentials; this is not the same as logging into Mailgun, and can be found under SMTP settings. Finally, make sure you have the correct server, e.g., smtp.eu.mailgun.org, smtp.mailgun.org, and test using command line, i.e., swaks.
I tried checking again, still the same issue. I am going to check with Digital Ocean and see if maybe the issue is from my droplet. I just read that with new accounts they tend to block SMTP with new accounts.
This proves that Mailgun is working correctly with the supplied credentials … you should have replaced foo@bar.com with one of your personal emails, so you received the message.
The next step is to look at the logs. These are located in ./content/logs.
I managed to get into the error log and it gave the following output:
I inputed a part of it since it was a repetition of the same thing.
{"name":"Log","hostname":"ghostonubuntu2204-s-1vcpu-1gb-nyc1-01","pid":10372,"level":50,"err":{"id":"11cc2300-77cf-11ed-bd6c-1fb8
a9b4282d","domain":"https://localandforeign.com","code":"EENVELOPE","name":"EmailError","statusCode":500,"level":"normal","messag
e":"Failed to send email. Reason: Data command failed: 421 Domain sandbox.mailgun.org is not allowed to send: Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipient
s in Account Settings..","help":"\"Please see https://ghost.org/docs/config/#mail for instructions on configuring email.\"","stac
k":"Error: Data command failed: 421 Domain sandbox.mailgun.org is not allowed to send: Sandbox su
bdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings.\
n at createMailError (/var/www/ghost/versions/5.25.2/core/server/services/mail/GhostMailer.js:68:12)\n at SMTPConnection._f
ormatError (/var/www/ghost/versions/5.25.2/node_modules/nodemailer/lib/smtp-connection/index.js:790:19)\n at SMTPConnection._a
ctionDATA (/var/www/ghost/versions/5.25.2/node_modules/nodemailer/lib/smtp-connection/index.js:1656:34)\n at SMTPConnection.<a
nonymous> (/var/www/ghost/versions/5.25.2/node_modules/nodemailer/lib/smtp-connection/index.js:1628:26)\n at SMTPConnection._p
rocessResponse (/var/www/ghost/versions/5.25.2/node_modules/nodemailer/lib/smtp-connection/index.js:953:20)\n at SMTPConnectio
n._onData (/var/www/ghost/versions/5.25.2/node_modules/nodemailer/lib/smtp-connection/index.js:755:14)\n at TLSSocket.SMTPConn
ection._onSocketData (/var/www/ghost/versions/5.25.2/node_modules/nodemailer/lib/smtp-connection/index.js:193:44)\n at TLSSock
et.emit (node:events:513:28)\n at addChunk (node:internal/streams/readable:315:12)\n at readableAddChunk (node:internal/str
eams/readable:289:9)\n at TLSSocket.Readable.push (node:internal/streams/readable:228:10)\n at TLSWrap.onStreamRead (node:i
nternal/stream_base_commons:190:23)","hideStack":false},"msg":"Failed to send email. Reason: Data command failed: 421 Domain sand
box.mailgun.org is not allowed to send: Sandbox subdomains are for test purposes only. Please add
your own domain or add the address to authorized recipients in Account Settings..","time":"2022-12-09T14:37:55.890Z","v":0}
{"name":"Log","hostname":"ghostonubuntu2204-s-1vcpu-1gb-nyc1-01","pid":20867,"level":50,"err":{"domain":"https://localandforeign.
com","code":"platform_api_key_expired","statusCode":401,"message":"Expired API Key provided: sk_live_****************************
*****************************************************************.
Platform access may have been revoked.","stack":"Error:
Expired API Key provided: sk_live_*********************************************************************************************. Platform access may have been revoked.\n at res.toJSON.then.StripeAPIError.message (/var/www/ghost/versions/5.25.2/node_
modules/stripe/lib/StripeResource.js:214:23)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)"},"msg":"
Expired API Key provided: sk_live_*********************************************************************************************.
domain":"https://localandforeign.com","code":"ETIMEDOUT","name":"EmailError","statusCode":500,"l
evel":"normal","message":"Failed to send email. Reason: Greeting never received.","help":"\"Please see https://ghost.org/docs/config/#mail for instructions on configuring email.\"","stack":"Error: Greeting never received\n at createMailError (/var/www/ghost/versions/5.25.2/core/server/services/mail/GhostMailer.js:68:12)\n at SMTPConnection._formatError (/var/www/ghost/versions/5.25.2/node_modules/nodemailer/lib/smtp-connection/index.js:790:19)\n at SMTPConnection._onError (/var/www/ghost/versions/5.25.2/node_modules/nodemailer/lib/smtp-connection/index.js:776:20)\n at Timeout.<anonymous> (/var/www/ghost/versions/5.25.2/node_modules/nodemailer/lib/smtp-connection/index.js:710:22)\n at listOnTimeout (node:internal/timers:559:17)\n at processTimers (node:internal/timers:502:7)","hideStack":false},"msg":"Failed to send email. Reason: Greeting never received.","time":"2022-12-09T17:41:05.126Z","v":0}
I tried to input my custom domain originally however since I am using the free account, it says I would have to update to paid plans. Over the weekend I will take a look at it and try to set it up properly again. I will let you know if that makes any difference, hopefully that will solve the issue. Thank you again for your help!