Ghost unable to send emails

They’re the credentials for whatever is specified in "host". Eg. Mailgun or Mandrill.

1 Like

The error message is:

Failed to send email. Reason: 140371041437568:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332: 

We’ve had something similar after the latest upgrade; while mailgun appears to be working, “local” mails to staff were failing; this was traced to Ghost rejecting the self-signed certificate of the local postfix installation (aka doing something against the norm - self-signed certificates are normal on local/internal postfix/other SMTP services), and further traced to a nodemailer setting. Adding

"tls": {
        "rejectUnauthorized": false
      },

resolved the issue for us.

I’d be surprised if it’s a localhost issue given the "transport" and "host" settings, but I’m really very new to Ghost so have a lot to learn and might need to tap out at this point! The only other clue I can see is that “port” is given as a string and as far as I know it should be a number. That is, "port": 587,, not "port": "587",.

Simple and great solution! I removed the port reference and configured simple. Worked!

1 Like

This recent issue does seem quite serious with regards to the old secureConnection being changed to secure within config.production.json, and it oddly and silently broke my Ghost site.

Probably good to notify everyone especially those who use Mailgun as an option to change the option within their config.production.json, as well as to upgrade to the latest Ghost version which is 4.18.0.

I actually went to change my entire Mailgun settings and it didn’t change the result. I must give thanks for you guys having a more recent discussion about this. Thanks! ;)

I faced the same problem. It turned out that the old secureConnection was changed to secure. To those running Ghost on GKE with Mailgun, you only need to set these:

  --set app.container.env.mail_options_port="2525"
  --set app.container.env.mail_options_secure="false"

I assume here you have these in your deployment settings for Ghost container

    - name: mail__options__port
      value: {{ .Values.app.container.env.mail_options_port | quote }}
    - name: mail__options__secure
     value: {{ .Values.app.container.env.mail_options_secure | quote }}

This is not the solution anymore. We explicitly need to add and set the “secure” key to “false” in order to work. I just tested.

1 Like

This is the correct answer, and the documentation is incorrect.

I hope this configuration helps someone. Should be added to documentation. Worked for us:

 "mail": {
    "from": "<EMAIL>",
    "transport": "SMTP",
    "options": {
      "service": "Mailgun",
      "host": "smtp.mailgun.org",
      "port": 465,
      "secure": true,
      "auth": {
        "user": "<USER>",
        "pass": "<PASS>"
      }
    }
  },
  "tls": {
    "rejectUnauthorized": false
  },
2 Likes

Thank you so much for posting this! All transactional emails broke on my install after upgrading to the latest minor release a few days ago.

I followed all the above, none of which worked, until I got to this final example. Now it is working again :)

May be worth noting that in my case I had used the “Direct” mail method in config (Mailgun was only configured in admin, for bulk emails) and the update broke this (exact same error log entry as above, re ssl version).

After switching to Mailgun with the settings above now, all is working again. It did appear to require every single entry listed in the example (including “from”).

This worked for me too.
I wonder if it could be fixed so it will work by default?

The only method that worked for Gmail was to remove the host, port, and secure options:

     "mail": {
       "from": "'X X' <xx@xx.xx>",
       "transport": "SMTP",
       "options": {
         "service": "Gmail",
         "auth": {
           "user": "X",
           "pass": "X"
         }
       }
     },