# Configure custom SMTP host in docker

**URL:** <https://forum.ghost.org/t/configure-custom-smtp-host-in-docker/30792>\
**Category:** Self-hosting\
**Created:** [June 14, 2022, 1:43pm UTC](https://forum.ghost.org/t/configure-custom-smtp-host-in-docker/30792 "2022-06-14T13:43:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nucker](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/nucker/32/13239_2.png) [@Nucker](https://forum.ghost.org/u/Nucker)\
**Post date:** [June 14, 2022, 1:43pm UTC](https://forum.ghost.org/t/configure-custom-smtp-host-in-docker/30792/1 "2022-06-14T13:43:28Z")

</div>

Hey there, I have ghost currently running in Docker and I would like to configre it to use a custom SMTP host. I believe you can do this in the config file, however I’m wondering if you can do it through environment variables, and if so, how?

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [June 14, 2022, 3:48pm UTC](https://forum.ghost.org/t/configure-custom-smtp-host-in-docker/30792/2 "2022-06-14T15:48:59Z")

</div>

Yep, take a look at [Configuration - Adapt your publication to suit your needs](https://ghost.org/docs/config/#running-ghost-with-config-env-variables)!

Do note that the variables have to be lowercase 🙂

---

<div class="post-metadata">

**Author:** ![Nucker](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/nucker/32/13239_2.png) [@Nucker](https://forum.ghost.org/u/Nucker)\
**Post date:** [June 14, 2022, 9:20pm UTC](https://forum.ghost.org/t/configure-custom-smtp-host-in-docker/30792/3 "2022-06-14T21:20:53Z")

</div>

Ah thanks! Is there anyway to use this with newsletters?

---

<div class="post-metadata">

**Author:** ![markstos](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/markstos/32/18182_2.png) [@markstos](https://forum.ghost.org/u/markstos)\
**Post date:** [June 15, 2022, 2:00am UTC](https://forum.ghost.org/t/configure-custom-smtp-host-in-docker/30792/4 "2022-06-15T02:00:45Z")

</div>

> [@Nucker](#):
>
> Is there anyway to use this with newsletters?

No. That’s covered in the FAQ [Why do I have to set up Mailgun?](https://ghost.org/docs/faq/mailgun-newsletters/)

---

<div class="post-metadata">

**Author:** ![Lakshmi\_Narasimman\_V](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/lakshmi_narasimman_v/32/17605_2.png) [@Lakshmi\_Narasimman\_V](https://forum.ghost.org/u/Lakshmi_Narasimman_V)\
**Post date:** [August 26, 2022, 9:45am UTC](https://forum.ghost.org/t/configure-custom-smtp-host-in-docker/30792/5 "2022-08-26T09:45:09Z")

</div>

Ok, I had the same problem. I have hosted my website on a Docker container and I had to edit the config.production.json file to add my credentials. I knew there must be some options to use environment variables and I found it in the actual documentation itself. Here’s my docker-compose.yml file on how to set up environment variables. Check out the documentation for more. [Configuration - Adapt your publication to suit your needs](https://ghost.org/docs/config/) Look under the “Running Ghost with config env variables”

 ![Screenshot 2022-08-26 at 2.59.15 PM](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/f/3/f35b9dd8bc329fa02e30baad9780673bb77f5569.png)  
section.

---

<div class="post-metadata">

**Author:** ![kasir-barati](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kasir-barati/32/30121_2.png) [@kasir-barati](https://forum.ghost.org/u/kasir-barati)\
**Post date:** [April 26, 2024, 1:52pm UTC](https://forum.ghost.org/t/configure-custom-smtp-host-in-docker/30792/6 "2024-04-26T13:52:44Z")

</div>

I have found a very straight forward way to do it in Docker: [How to add SMTP (mail) configuration? - #9 by kasir-barati](https://forum.ghost.org/t/how-to-add-smtp-mail-configuration/40981/9)

---

<div class="post-metadata">

**Author:** ![Cathy\_Sarisky](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/cathy_sarisky/32/25750_2.png) [@Cathy\_Sarisky](https://forum.ghost.org/u/Cathy_Sarisky)\
**Post date:** [April 26, 2024, 2:01pm UTC](https://forum.ghost.org/t/configure-custom-smtp-host-in-docker/30792/7 "2024-04-26T14:01:05Z")

</div>

Please don’t bump every thread about Docker and SMTP with a link to your repo. Once is good! :)
