# Taiga docker: Email only works with CONSOLE backend

**URL:** <https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023>\
**Category:** Self hosted Taiga\
**Tags:** issues, docker\
**Created:** [October 19, 2023, 7:21pm UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023 "2023-10-19T19:21:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriel](https://dub1.discourse-cdn.com/flex017/user_avatar/community.taiga.io/gabriel/32/1680_2.png) [@gabriel](https://community.taiga.io/u/gabriel)\
**Post date:** [October 19, 2023, 7:21pm UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/1 "2023-10-19T19:21:10Z")

</div>

Hello, community.

I can see the emails Taiga CE sends in the **taiga-back** container’s log but when I set the EMAIL\_BACKEND from console to smtp it seems emails dont reach my company internal email server.

I do know the company local SMTP server is working because other apps and scripts of mine use it and I have issued the following from inside taiga-back container:

`$ curl --url 'smtp://smtp.mailserver.mycompany.domain.com:25' --mail-from 'sender@mycompany.domain.com' --mail-rcpt 'myself@mycompany.domain.com' --upload-file sample.file --insecure`

Here’s **taiga-docer/.env** file:

```auto
[.....]
# Taiga's SMTP settings - Variables to send Taiga's emails to the users
EMAIL_BACKEND=smtp # use an SMTP server or display the emails in the console (either "smtp" or "console")
EMAIL_HOST=smtp.mailserver.mycompany.domain.com # SMTP server address
EMAIL_PORT=25 # default SMTP port
EMAIL_HOST_USER= # user to connect the SMTP server
EMAIL_HOST_PASSWORD= # SMTP user's password
EMAIL_DEFAULT_FROM=myself@mycompany.domain.com # default email address for the automated emails
EMAIL_USE_TLS=False # use TLS (secure) connection with the SMTP server
EMAIL_USE_SSL=False # use implicit TLS (secure) connection with the SMTP server
[.....]

```

And when I enter the container:

```auto
$ docker exec -it taiga-docker-taiga-back-1 bash
root@a2d1b2910182:/taiga-back#

```

The email section in the settings/config.py file states:

```auto
#########################################
## EMAIL
#########################################
# https://docs.djangoproject.com/en/3.1/topics/email/
EMAIL_BACKEND = os.getenv('EMAIL_BACKEND', 'django.core.mail.backends.console.EmailBackend')
CHANGE_NOTIFICATIONS_MIN_INTERVAL = 120 # seconds

DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'system@taiga.io')
EMAIL_USE_TLS = os.getenv('EMAIL_USE_TLS', 'False') == 'True'
EMAIL_USE_SSL = os.getenv('EMAIL_USE_SSL', 'False') == 'True'
EMAIL_HOST = os.getenv('EMAIL_HOST', 'localhost')
EMAIL_PORT = os.getenv('EMAIL_PORT', 587)
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER', 'user')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD', 'password')

```

Seems like the settings are not there.

Maybe I am looking at the wrong file or perhaps that’s the way it is and I must look in another container.

---

<div class="post-metadata">

**Author:** ![Charlie](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@Charlie](https://community.taiga.io/u/Charlie)\
**Post date:** [October 20, 2023, 8:31am UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/2 "2023-10-20T08:31:01Z")

</div>

Hi there,

The settings are exposed to taiga-back as environment variables, so if you do `echo $EMAIL_HOST` or any of the other variables, then you can see if they are set or not. If they are not, then python will get the default value (the second argument there to `os.getenv()`

After you set those variables on the .env file, though, make sure to restart the docker containers.

Regards!

---

<div class="post-metadata">

**Author:** ![gabriel](https://dub1.discourse-cdn.com/flex017/user_avatar/community.taiga.io/gabriel/32/1680_2.png) [@gabriel](https://community.taiga.io/u/gabriel)\
**Post date:** [October 20, 2023, 7:26pm UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/3 "2023-10-20T19:26:24Z")

</div>

Great! ✅ The environment variables were set correctly:

```auto

$ docker exec -it taiga-docker-taiga-back-1 bash

root@a2d1b2910182:/taiga-back # env |grep EMAIL

EMAIL_HOST=smtp.mailserver.mycompany.domain.com
EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
EMAIL_PORT=25
DEFAULT_FROM_EMAIL= myself@mycompany.domain.com

```

Now, the second stage is how to force Taiga to send my user an email message without changing my password.

Is there a way to do that?

---

<div class="post-metadata">

**Author:** ![Charlie](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@Charlie](https://community.taiga.io/u/Charlie)\
**Post date:** [October 23, 2023, 8:21am UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/4 "2023-10-23T08:21:50Z")

</div>

It should be possible. Outside the docker container there should be a `taiga-manage.sh` script. Django’s `manage.py` (which is what the script uses under the hood) has a command called `sendtestemail`. You should be able to call `taiga-manage.sh sendtestemail your@email` and check if you receive it.

---

<div class="post-metadata">

**Author:** ![gabriel](https://dub1.discourse-cdn.com/flex017/user_avatar/community.taiga.io/gabriel/32/1680_2.png) [@gabriel](https://community.taiga.io/u/gabriel)\
**Post date:** [October 23, 2023, 7:31pm UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/5 "2023-10-23T19:31:52Z")

</div>

Yes, it is possible to invoke the builtin mail sender…

```auto
$ ./taiga-manage.sh sendtestemail myself@mycompany.domain.com
+ exec docker compose -f docker-compose.yml -f docker-compose-inits.yml run --rm taiga-manage sendtestemail myself@mycompany.domain.com
[+] Creating 1/0
 ✔ Container taiga-docker-taiga-db-1 Running 0.0s
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: Test email from 121adf64ec04 on 2023-10-23 19:19:19.125237+00:00
From: system@taiga.io
To: myself@mycompany.domain.com
Date: Mon, 23 Oct 2023 19:19:19 -0000
Message-ID: <169808875912.1.3137052844105060992@121adf64ec04>

If you're reading this, it was successful.
-------------------------------------------------------------------------------

```

…but my company SMTP server is not allowing to send email when the FROM: is an address from outside the domain (`system@taiga.io`)

I tried by entering the taiga-back container and changing the

```auto
DEFAULT_FROM_EMAIL = os.getenv('DEFAULT_FROM_EMAIL', 'system@taiga.io')

```

line and the running again the sendtestemail line and the sender address kept the same. I think I should properly access taiga-manage image in order to alter it and don’t know how to do it.

Anyway, I should be able to alter the values of the `taiga-back` DEFAULT\_FROM\_EMAIL variable in order for the Django subsystem to work properly for my facility: using a [valid\_address@mycompay.domain.com](mailto:valid_address@mycompay.domain.com) as the sender address.

---

<div class="post-metadata">

**Author:** ![Charlie](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@Charlie](https://community.taiga.io/u/Charlie)\
**Post date:** [October 24, 2023, 8:01am UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/6 "2023-10-24T08:01:27Z")

</div>

Hi there,

You can alter them changing the EMAIL\_DEFAULT\_FROM environment variable and then restarting the container.

Did you try that?

Regards!

---

<div class="post-metadata">

**Author:** ![gabriel](https://dub1.discourse-cdn.com/flex017/user_avatar/community.taiga.io/gabriel/32/1680_2.png) [@gabriel](https://community.taiga.io/u/gabriel)\
**Post date:** [October 26, 2023, 1:39pm UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/7 "2023-10-26T13:39:39Z")

</div>

The environment variable is already set in the `.env` file, so I take the value from there and…

```auto
$ pwd
/home/localuser/repos/taiga-docker
$ grep EMAIL_DEFAULT .env
#EMAIL_DEFAULT_FROM=changeme@example.com # default email address for the automated emails
EMAIL_DEFAULT_FROM=valid.address@mycompany.domain.com # default email address for the automated emails

```

… since the invokation of `./taiga-manage.sh` uses `docker-compose.yml` as an argument for the container `taiga-manage`, I check the variable assignation:

```auto
$ grep EMAIL_DEFAULT docker-compose.yml
  DEFAULT_FROM_EMAIL: "${EMAIL_DEFAULT_FROM}"

```

… and export the shell environment variable outside the container:

```auto
$ export EMAIL_DEFAULT_FROM=valid.address@mycompany.domain.com

```

…then lauch the `taiga-manage.sh` script:

```auto
$ ./taiga-manage.sh sendtestemail myself@mycompany.domain.com
+ exec docker compose -f docker-compose.yml -f docker-compose-inits.yml run --rm taiga-manage sendtestemail myself@mycompany.domain.com
[+] Creating 1/0
 ✔ Container taiga-docker-taiga-db-1 Running 0.0s
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: Test email from 12902d90c9ef on 2023-10-26 13:23:52.753954+00:00
From: system@taiga.io
To: myself@mycompany.domain.com
Date: Thu, 26 Oct 2023 13:23:52 -0000
Message-ID: <169832663278.1.16863504282308229665@12902d90c9ef>

If you're reading this, it was successful.
-------------------------------------------------------------------------------
$

```

…but it still is using the same value for the email from address.

Please specify where should I change the EMAIL\_DEFAULT\_FROM environment variable.

---

<div class="post-metadata">

**Author:** ![Charlie](https://avatars.discourse-cdn.com/v4/letter/c/d6d6ee/32.png) [@Charlie](https://community.taiga.io/u/Charlie)\
**Post date:** [November 2, 2023, 8:31am UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/8 "2023-11-02T08:31:01Z")

</div>

Hi there,

`EMAIL_DEFAULT_FROM` should only be set on the `.env` file.

Inside the container, it gets translated to `DEFAULT_FROM_EMAIL`, which is used by Taiga’s `config.py`.

You can check if it is set correctly by going inside a shell in `taiga-back` and executing `echo DEFAULT_FROM_EMAIL`.

If that variable is not set to the same value that you set as `EMAIL_DEFAULT_FROM` on the `.env` file, try doing `docker-compose restart` and try again.

Regards!

---

<div class="post-metadata">

**Author:** ![gabriel](https://dub1.discourse-cdn.com/flex017/user_avatar/community.taiga.io/gabriel/32/1680_2.png) [@gabriel](https://community.taiga.io/u/gabriel)\
**Post date:** [November 3, 2023, 3:50pm UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/9 "2023-11-03T15:50:36Z")

</div>

Hi, there.

Maybe something weird is happening or I am missing something in the way because the `.env` file hast the correct `valid.address@mycompany.domain.com` and if I go to a shell in the `taiga-back container` and check the content of the `DEFAULT_FROM_EMAIL` it is [valid.address@mycompany.domain.com](mailto:valid.address@mycompany.domain.com), too.

But executing the `taiga-manager.sh` script still uses `system@taiga.io` as the sender address and my company SMTP server policies doesn’t allow that.

So, the email is not accepted for delivery, I guess. I need to change the sender’s address.

Regards,

---

<div class="post-metadata">

**Author:** ![Bodo](https://avatars.discourse-cdn.com/v4/letter/b/f0a364/32.png) [@Bodo](https://community.taiga.io/u/Bodo)\
**Post date:** [July 25, 2024, 11:03am UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/10 "2024-07-25T11:03:55Z")

</div>

I am having the same problem.  
So if you have any solution to setting an other from-adress please post

Its still not working. I have also tried using a localhost postfix configuration.

Regards

---

<div class="post-metadata">

**Author:** ![Bodo](https://avatars.discourse-cdn.com/v4/letter/b/f0a364/32.png) [@Bodo](https://community.taiga.io/u/Bodo)\
**Post date:** [July 25, 2024, 11:58am UTC](https://community.taiga.io/t/taiga-docker-email-only-works-with-console-backend/2023/11 "2024-07-25T11:58:11Z")

</div>

There is a typo:

It has to be:

echo $DEFAULT\_FROM\_EMAIL
