[Solved suddenly] Mail fails to send after a new installation: error: `1408F10B:SSL routines:ssl3_get_record:wrong`

After a fresh installation of Ghost in Azure server( Ubuntu 20.4.3, Ghost: * Version: 4.32.3) , the mail function does not work.
Here is the config, also tried "secure": false, still it does not work;
before using this config, the default method “direct” also does not work.

"mail": {
    "from": "'DDD' <hi@ddd.kkk>",
    "transport": "SMTP",
    "options": {
      "service": "Mailersend",
      "host": "smtp.mailersend.net",
      "port": 587,
      "secure": true,
      "auth": {
        "user": "dddddd@lolololo.de",
        "pass": "dddddddd"
      }
    }
  },

Log

[2022-01-16 11:32:17] ERROR "POST /ghost/api/canary/admin/settings/members/email/" 400 536ms

NAME: BadRequestError
CODE: ESOCKET
MESSAGE: Failed Sending Email

level: normal

"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
Error: 140249578227584:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

This config is also tried, but the error is still reproduced.

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

When the mail is in “direct” mode, log does not show any error; but the email was not sent out.

[2022-01-16 10:28:15] INFO "POST /ghost/api/canary/admin/settings/members/email/" 200 60057ms


===== Another experiment =====
Switch from Mailersend to Gmail, error is still reproduced.
Port 465, secure = true

[2022-01-16 10:45:13] ERROR "POST /ghost/api/canary/admin/settings/members/email/" 400 862ms

NAME: BadRequestError
CODE: EAUTH
MESSAGE: Failed Sending Email

level: normal

"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at

Port 465 secure = false

[2022-01-16 10:46:42] ERROR "POST /ghost/api/canary/admin/settings/members/email/" 400 11571ms

NAME: BadRequestError
MESSAGE: Failed Sending Email

level: normal

"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
Error: Unexpected socket close

Port 587 secure = false

[2022-01-16 10:51:22] ERROR "POST /ghost/api/canary/admin/settings/members/email/" 400 1536ms

NAME: BadRequestError
CODE: EAUTH
MESSAGE: Failed Sending Email

level: normal

"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at

Port 587, secure = true

[2022-01-16 10:52:50] ERROR "POST /ghost/api/canary/admin/settings/members/email/" 400 330ms

NAME: BadRequestError
CODE: ESOCKET
MESSAGE: Failed Sending Email

level: normal

"Please see https://ghost.org/docs/config/#mail for instructions on configuring email."
Error: 140072630990720:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

The problem has been solved.
Set secure to false and it suddenly works.