Subscribe button does not work

Hi there,

I use local hosted Ghost. My mailgun server is already up and running and when I test to myself, the email was sent.

However, when I try to input email address in my homepage and click subscribe, the subscribe button keeps rotating endlessly.

Can anyone help?

You can try my blog here. https://christje.com/signup/

Hi @Christ_Je,

have you set up your mail in config.production.json properly?
The Mailgun settings in ghost admin - labs - mailgun are only used for sending newsletters and not transactional mails like signins/signups/subscribtions.

Hi @daniel1,

Yes, I already setup my config.production.json according to this

https://ghost.org/docs/concepts/config/?&_ga=2.79359828.1509125417.1593660606-1417309003.1593660606#mail]

What do you mean by not transactional email?

Hi,

could you double check, that the config.production.json mail config is correct?

"mail": {
    "transport": "SMTP",
    "options": {
        "service": "Mailgun",
        "host": "smtp.eu.mailgun.org",
        "port": 465,
        "secureConnection": true,
        "auth": {
            "user": "postmaster@example.mailgun.org",
            "pass": "1234567890"
        }
    }
}

If that is definitely correct, could you check your ghost error.log at /ghost/content/logs/*.error.log?

EDIT: Transactional mails and marketing mails are differentiated in some factors.
Email delivery sounds easy, but there can be some caveats.
Transactional mails include things like: signin,signup,subscribe, receipts etc. so in general mails that should be delivered immediately to one distinct user, while marketing emails like newsletters are sent to multiple users at the same time, they don’t necessarly have to have a high deliverability.

What i meant:

  • Ghost Admin - Labs - Mailgun settings
    is used to send newsletter email via mailgun

  • Mail configuration in config.production.json
    is used to send signin/signup/subscribe email

Yes, I have.

The ghost error log looks like this.

{"name":"Log","hostname":"daenerys.id.rapidplex.com","pid":178993,"level":50,"err":{"id":"01e5bb20-bd8e-11ea-a212-c7988471bdcd","domain":"https://christje.com/","code":null,"name":"EmailError","statusCode":500,"level":"normal","message":"Failed to send email. Reason: connect ECONNREFUSED 104.47.33.33:25.","help":"\"Please see https://ghost.org/docs/concepts/config/#mail for instructions on configuring email.\"","stack":"EmailError: Failed to send email. Reason: connect ECONNREFUSED 104.47.33.33:25.\n at EmailError.GhostError (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/@tryghost/errors/lib/errors.js:10:26)\n at new EmailError (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/@tryghost/errors/lib/errors.js:34:20)\n at createMailError (/home/christje/cms-ghost/apps/versions/3.18.1/core/server/services/mail/GhostMailer.js:51:12)\n at EventEmitter.<anonymous> (/home/christje/cms-ghost/apps/versions/3.18.1/core/server/services/mail/GhostMailer.js:117:28)\n at Object.onceWrapper (events.js:286:20)\n at EventEmitter.emit (events.js:198:13)\n at EventEmitter.emit (domain.js:448:20)\n at DirectMailer.<anonymous> (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/directmail/lib/mailer.js:185:42)\n at SMTPClient.<anonymous> (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/directmail/lib/mailer.js:277:9)\n at Object.onceWrapper (events.js:286:20)\n at SMTPClient.emit (events.js:198:13)\n at SMTPClient.EventEmitter.emit (domain.js:448:20)\n at SMTPClient._onError (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/simplesmtp/lib/client.js:373:10)\n at Socket.emit (events.js:198:13)\n at Socket.EventEmitter.emit (domain.js:448:20)\n at emitErrorNT (internal/streams/destroy.js:91:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)\n at process._tickCallback (internal/process/next_tick.js:63:19)"},"msg":"Failed to send email. Reason: connect ECONNREFUSED 104.47.33.33:25.","time":"2020-07-04T00:33:40.308Z","v":0}

Hi,
please see my prior posted example and add:

  • secure connection attribute

  • host attribute
    in your mail config.

You can find the right host domain in Mailgun Dashboard - Sending - Domain Settings - SMTP credentials

I did actually do that.

But still, there is still error when I want to subscribe…

That’s why I was so confused on how. Online the subscribe button does not work. The rest already been checked by mailgun.

Could you please change port to 465 in your mail config (restart ghost after that)
and see if that changes the error. Also please update your ghost version.

Hi @daniel1, thank you for the constant support. But, I have tried changing to the 3 port but still cannot have the subscription.

Okay, let’s try something else, so we can rule out misconfiguration in ghost itself.
Let’s try to send mails directly from your server (without mailgun):
Please edit mail in config.production.json like so:

"mail": {
    "transport": "Direct"
  },

If the signup/signin form works, see if mail gets delivered
(it will most likely be in your spam folder!)

Keep me updated!

Still cannot subscribe :slight_smile: I don’t know what happen but I think there might be error in the root folder?

The error log is like this:

{"name":"Log","hostname":"daenerys.id.rapidplex.com","pid":178993,"level":50,"err":{"id":"90fd0e00-bedb-11ea-a212-c7988471bdcd","domain":"https://christje.com/","code":null,"name":"EmailError","statusCode":500,"level":"normal","message":"Failed to send email. Reason: connect ECONNREFUSED 104.47.55.161:25.","help":"\"Please see https://ghost.org/docs/concepts/config/#mail for instructions on configuring email.\"","stack":"EmailError: Failed to send email. Reason: connect ECONNREFUSED 104.47.55.161:25.\n at EmailError.GhostError (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/@tryghost/errors/lib/errors.js:10:26)\n at new EmailError (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/@tryghost/errors/lib/errors.js:34:20)\n at createMailError (/home/christje/cms-ghost/apps/versions/3.18.1/core/server/services/mail/GhostMailer.js:51:12)\n at EventEmitter.<anonymous> (/home/christje/cms-ghost/apps/versions/3.18.1/core/server/services/mail/GhostMailer.js:117:28)\n at Object.onceWrapper (events.js:286:20)\n at EventEmitter.emit (events.js:198:13)\n at EventEmitter.emit (domain.js:448:20)\n at DirectMailer.<anonymous> (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/directmail/lib/mailer.js:185:42)\n at SMTPClient.<anonymous> (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/directmail/lib/mailer.js:277:9)\n at Object.onceWrapper (events.js:286:20)\n at SMTPClient.emit (events.js:198:13)\n at SMTPClient.EventEmitter.emit (domain.js:448:20)\n at SMTPClient._onError (/home/christje/cms-ghost/apps/versions/3.18.1/node_modules/simplesmtp/lib/client.js:373:10)\n at Socket.emit (events.js:198:13)\n at Socket.EventEmitter.emit (domain.js:448:20)\n at emitErrorNT (internal/streams/destroy.js:91:8)\n at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)\n at process._tickCallback (internal/process/next_tick.js:63:19)"},"msg":"Failed to send email. Reason: connect ECONNREFUSED 104.47.55.161:25.","time":"2020-07-05T16:21:22.786Z","v":0}

I see,

could you please update your ghost cli and ghost version, by running following commands in ghost terminal:

  • sudo npm i -g ghost-cli@latest
  • ghost update

You still run 3.18.1, the newest version is 3.22.1

Hi,
I changed to “Direct”, and i tested to do subscribe, It takes long time with rolling circle on continue and later getting same error “Please enter a valid email address!”

After Looking at logs : Got strange errors for your Ref.

[2020-09-01 18:31:23] INFO “POST /members/api/send-magic-link/” 200 60039ms
[2020-09-01 18:31:23] INFO “POST /members/api/send-magic-link/” 200 60041ms
[2020-09-01 18:32:33] ERROR
NAME: EmailError
MESSAGE: Failed to send email. Reason: connect ETIMEDOUT 74.125.24.26:465.

level: normal

“Please see https://ghost.org/docs/concepts/config/#mail for instructions on configuring email.”
EmailError: Failed to send email. Reason: connect ETIMEDOUT 74.125.24.26:465.
at EmailError.GhostError (/var/www/blog1/versions/3.31.2/node_modules/@tryghost/errors/lib/errors.js:10:26)
at new EmailError (/var/www/blog1/versions/3.31.2/node_modules/@tryghost/errors/lib/errors.js:34:20)
at createMailError (/var/www/blog1/versions/3.31.2/core/server/services/mail/GhostMailer.js:52:12)
at EventEmitter. (/var/www/blog1/versions/3.31.2/core/server/services/mail/GhostMailer.js:119:28)
at Object.onceWrapper (events.js:286:20)
at EventEmitter.emit (events.js:198:13)
at EventEmitter.emit (domain.js:448:20)
at DirectMailer. (/var/www/blog1/versions/3.31.2/node_modules/directmail/lib/mailer.js:185:42)
at SMTPClient. (/var/www/blog1/versions/3.31.2/node_modules/directmail/lib/mailer.js:277:9)
at Object.onceWrapper (events.js:286:20)
at SMTPClient.emit (events.js:198:13)
at SMTPClient.EventEmitter.emit (domain.js:448:20)
at SMTPClient._onError (/var/www/blog1/versions/3.31.2/node_modules/simplesmtp/lib/client.js:373:10)
at TLSSocket.emit (events.js:198:13)
at TLSSocket.EventEmitter.emit (domain.js:448:20)
at emitErrorNT (internal/streams/destroy.js:91:8)

[2020-09-01 18:33:36] INFO “GET /content/images/2020/06/blog.gif.gif” 200 20ms
[2020-09-01 18:34:44] ERROR

NAME: EmailError
MESSAGE: Failed to send email. Reason: connect ETIMEDOUT 74.125.24.26:465.

level: normal

“Please see https://ghost.org/docs/concepts/config/#mail for instructions on configuring email.”
EmailError: Failed to send email. Reason: connect ETIMEDOUT 74.125.24.26:465.
at EmailError.GhostError (/var/www/blog1/versions/3.31.2/node_modules/@tryghost/errors/lib/errors.js:10:26)
at new EmailError (/var/www/blog1/versions/3.31.2/node_modules/@tryghost/errors/lib/errors.js:34:20)
at createMailError (/var/www/blog1/versions/3.31.2/core/server/services/mail/GhostMailer.js:52:12)
at EventEmitter. (/var/www/blog1/versions/3.31.2/core/server/services/mail/GhostMailer.js:119:28)
at Object.onceWrapper (events.js:286:20)
at EventEmitter.emit (events.js:198:13)
at EventEmitter.emit (domain.js:448:20)
at DirectMailer. (/var/www/blog1/versions/3.31.2/node_modules/directmail/lib/mailer.js:185:42)
at SMTPClient. (/var/www/blog1/versions/3.31.2/node_modules/directmail/lib/mailer.js:277:9)
at Object.onceWrapper (events.js:286:20)
at SMTPClient.emit (events.js:198:13)
at SMTPClient.EventEmitter.emit (domain.js:448:20)
at SMTPClient._onError (/var/www/blog1/versions/3.31.2/node_modules/simplesmtp/lib/client.js:373:10)
at TLSSocket.emit (events.js:198:13)
at TLSSocket.EventEmitter.emit (domain.js:448:20)
at emitErrorNT (internal/streams/destroy.js:91:8)

+++++++++++++++++++++++++++++++++++++++++++++
Q : Strange IP: 74.125.24.26, why its connecting to google ? where as my email host ip is different. Note : This is only happening if change to “Direct” in transport properties.

Here is my config.production.json file

“mail”: {
“from”: “Blog Mailer dmart@mydomain.com”,
“transport”: “Direct”,
“options”: {
“service”: “email”,
“host”: “mail.mydomain.com”,
“port”: 465,
“secureConnection”: true,
“ignoreTLS”: true,
“auth”: {
“user”: “dmart@mydomain.com”,
“pass”: “xxxxx”
}