# Can't set up smtp

**URL:** <https://forum.ghost.org/t/cant-set-up-smtp/49440>\
**Category:** Using Ghost\
**Created:** [August 9, 2024, 4:53pm UTC](https://forum.ghost.org/t/cant-set-up-smtp/49440 "2024-08-09T16:53:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Przemas](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/przemas/32/5675_2.png) [@Przemas](https://forum.ghost.org/u/Przemas)\
**Post date:** [August 9, 2024, 4:53pm UTC](https://forum.ghost.org/t/cant-set-up-smtp/49440/1 "2024-08-09T16:53:46Z")

</div>

I’m trying to set email sending on Ghost running inside docker (behind reverse proxy and cloudflare).

I’m using smtp2go as an smtp provider and I use credentials that work in other container (Bookstack). Here are the variables I pass to container:

```auto
mail__from: user@mydomain.com
mail __options__ auth__user: username
mail __options__ auth__pass: password
mail __options__ host: mail.smtp2go.com
mail __options__ port: 465
mail __options__ secure: true
mail __options__ service: smtp2go
mail __options__ transport: SMTP

```

Here are the errors I see in the logs when attempting to send message:

```auto
[2024-08-09 16:44:06] ERROR "POST /ghost/api/admin/invites/" 500 2865ms

Error sending email: Failed to send email. Reason: Sending failed. Please check your email settings and resend the invitation.

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

Error ID:
    97b72c10-566e-11ef-9a09-ade95c20340c

----------------------------------------

Error: Sending failed
    at createMailError (/var/lib/ghost/versions/5.89.0/core/server/services/mail/GhostMailer.js:105:12)
    at DirectMailer.<anonymous> (/var/lib/ghost/versions/5.89.0/node_modules/nodemailer-direct-transport/lib/direct-transport.js:157:41)
    at DirectMailer.<anonymous> (/var/lib/ghost/versions/5.89.0/node_modules/nodemailer-direct-transport/lib/direct-transport.js:228:30)
    at /var/lib/ghost/versions/5.89.0/node_modules/nodemailer-direct-transport/lib/direct-transport.js:350:28
    at callback (/var/lib/ghost/versions/5.89.0/node_modules/smtp-connection/lib/smtp-connection.js:374:14)
    at SMTPConnection.<anonymous> (/var/lib/ghost/versions/5.89.0/node_modules/smtp-connection/lib/smtp-connection.js:385:20)
    at SMTPConnection._actionRCPT (/var/lib/ghost/versions/5.89.0/node_modules/smtp-connection/lib/smtp-connection.js:1313:20)
    at SMTPConnection.<anonymous> (/var/lib/ghost/versions/5.89.0/node_modules/smtp-connection/lib/smtp-connection.js:1265:26)
    at SMTPConnection._processResponse (/var/lib/ghost/versions/5.89.0/node_modules/smtp-connection/lib/smtp-connection.js:669:16)
    at SMTPConnection._onData (/var/lib/ghost/versions/5.89.0/node_modules/smtp-connection/lib/smtp-connection.js:493:10)
    at TLSSocket.emit (node:events:517:28)
    at TLSSocket.emit (node:domain:489:12)
    at addChunk (node:internal/streams/readable:368:12)
    at readableAddChunk (node:internal/streams/readable:341:9)
    at Readable.push (node:internal/streams/readable:278:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)

```

Has anyone managed to set up Ghost with smtp2go or any ideas what am I doing wrong?

---

<div class="post-metadata">

**Author:** ![mjw](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/mjw/32/30781_2.png) [@mjw](https://forum.ghost.org/u/mjw)\
**Post date:** [August 10, 2024, 8:25pm UTC](https://forum.ghost.org/t/cant-set-up-smtp/49440/2 "2024-08-10T20:25:34Z")

</div>

The logs mentioned TLS, so I checked their support pages.

> **SMTP port** : 2525 (or 80, 25, 8025 or 587 if that doesn’t work).

You need to set the port to 587 not 465 (which is depreciated anyway), and `secure` to false.

---

<div class="post-metadata">

**Author:** ![Przemas](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/przemas/32/5675_2.png) [@Przemas](https://forum.ghost.org/u/Przemas)\
**Post date:** [August 18, 2024, 8:54pm UTC](https://forum.ghost.org/t/cant-set-up-smtp/49440/3 "2024-08-18T20:54:36Z")

</div>

tried that and it didn’t work. Tried using the recommended Mailgun service and still can’t get it to work. I get:

```auto
[2024-08-18 20:51:37] ERROR "POST /ghost/api/admin/invites/" 500 150ms

Error sending email: Failed to send email. Reason: D8190C64F77F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
. Please check your email settings and resend the invitation.

```

Environment section of my compose file looks like this:

```auto
    environment:
      url: https://domain.com
      mail__transport: SMTP
      mail __options__ service: Mailgun
      mail __options__ host: smtp.eu.mailgun.org
      mail __options__ port: 587
      mail __options__ auth__user: noreply-ghost@domain.com
      mail __options__ auth__pass: somepass

```
