Taiga on Docker, email not working

Hello people,
I just did a fresh install of Taiga on my Docker host and after a few issues I managed to get it to work but no matter what, the email is not working.

Following the email configurations from the docs Install Taiga in Production I put the email configs in the env settings of Portainer.

Any idea?

Thanks in advance

Hi @adispy

According to your screenshot, you are using console as EMAIL_BACKNED so emails are being printed through the console (along with the rest of the logs).
Change it to smtp if you want to send via smtp server.

I hope this can help

Best regards

I have tired both, smtp and console and still not working. This was the last try when I captured the screen.

Are there any logs somewhere? If so, in which of the taiga containers?

Anyone?
I looked out on the internet but can’t find any valid answer and looks like there are a lot of email issues.

Do I need a SMTP agent installed on the docker host?

Hi @adispy

Taiga use the command email libs from python (specifically the implementation offered by Django) so it is something that is highly proven so errors are usually related to finding the appropriate values for configuration parameters.

Something that would be great is to have a command in taiga to test the SMTP connection with the server. But there isn’t. There is a command to send emails that is used to test all the emails in the application. But you need to load the sample data first.

docker compose exec taiga-back python manage.py sample_data
docker compose exec taiga-back python manage.py test_emails my_email@email.com

The first command creates example users and projects on the platform and the second sends an example of each email to the indicated email address. This way you can prove that the sending is done correctly.

There is another option, using the python shell.

docker compose exec taiga-back python manage.py shell

And type

from django.core.mail import send_mail
send_mail("subject", "body", "from@email.com", ["to@email.com"])

These two methods should show you the connection error traces on the screen.

On the other hand, to see the logs of the email sending in the platform you should review the taiga-back and taiga-async service (the emails are sent from an asynchronous task soemtimes).

This is an example error after an invitation has been sent:

I hope this info can help you.

Best regards

Hi David,
Thank you for your patience, but where can I get that sample_data file because I am getting the following error message:

no configuration file provided: not found

Thanks,

sample_data is not a file, is a command

docker compose exec taiga-back python manage.py sample_data

Execute the comand python manage.py sample_data inside the container taiga-back (the command takes a few minutes)

Tried it, but still does not work. It cannot find python and trying to install it does’n work either.

Also, in the Docker host I browse to the volume of taiga-back and still not working, same error as posted previous.

I run the command outside de containers (from the taiga-docker directory).

But I don’t understant why you have taiga-back code inside /srv/taiga/back. It should be in /taiga-back

(I’m so sorry, but it’s difficult for me to indicate the steps you need to follow if you use an environment other than the one described in the documentation. I don’t use Portainer nor have I tried installing taiga there)

Hey, i am trying to setup SMTP as well but i cannot get it to work for the life of me.

i followed your instructions and these are the outputs:

Results with TLS:
command:

python manage.py test_emails kees.rodriguez@gmail.com

result:

Traceback (most recent call last):
  File "/taiga-back/manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/venv/lib/python3.11/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/venv/lib/python3.11/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/taiga-back/taiga/base/management/commands/test_emails.py", line 48, in handle
    email.send()
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
    new_conn_created = self.open()
                       ^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 69, in open
    self.connection.login(self.username, self.password)
  File "/usr/local/lib/python3.11/smtplib.py", line 716, in login
    raise SMTPNotSupportedError(
smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.

command:

from django.core.mail import send_mail
send_mail("subject", "body", "kreativekompas@gmail.com", ["kees.rodriguez@gmail.com"])

result:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/__init__.py", line 61, in send_mail
    return mail.send()
           ^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
    new_conn_created = self.open()
                       ^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 69, in open
    self.connection.login(self.username, self.password)
  File "/usr/local/lib/python3.11/smtplib.py", line 716, in login
    raise SMTPNotSupportedError(
smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.

Results with SSL:

command:

python manage.py test_emails kees.rodriguez@gmail.com

result:

Traceback (most recent call last):
  File "/taiga-back/manage.py", line 17, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/venv/lib/python3.11/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/venv/lib/python3.11/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/taiga-back/taiga/base/management/commands/test_emails.py", line 48, in handle
    email.send()
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
    new_conn_created = self.open()
                       ^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 62, in open
    self.connection = self.connection_class(self.host, self.port, **connection_params)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/smtplib.py", line 343, in connect
    (code, msg) = self.getreply()
                  ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/smtplib.py", line 405, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

command:

from django.core.mail import send_mail
send_mail("subject", "body", "kreativekompas@gmail.com", ["kees.rodriguez@gmail.com"])

result:

send_mail("subject","body","kreativekompas@gmail.com",["kees.rodriguez@gmail.com"])
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/__init__.py", line 61, in send_mail
    return mail.send()
           ^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/message.py", line 284, in send
    return self.get_connection(fail_silently).send_messages([self])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
    new_conn_created = self.open()
                       ^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/django/core/mail/backends/smtp.py", line 62, in open
    self.connection = self.connection_class(self.host, self.port, **connection_params)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/smtplib.py", line 255, in __init__
    (code, msg) = self.connect(host, port)
                  ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/smtplib.py", line 343, in connect
    (code, msg) = self.getreply()
                  ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/smtplib.py", line 405, in getreply
    raise SMTPServerDisconnected("Connection unexpectedly closed")
smtplib.SMTPServerDisconnected: Connection unexpectedly closed

i use the settings provided from google: Send email from a printer, scanner, or app - Google Workspace Admin Help

and it works with other apps.

this is what is in my .env file:

# 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.gmail.com  # SMTP server address
EMAIL_PORT=587  # default SMTP port
EMAIL_HOST_USER=kreativekompas@gmail.com  # user to connect the SMTP server
EMAIL_HOST_PASSWORD=PASSWORD # SMTP user's password
EMAIL_DEFAULT_FROM=kreativekompas@gmail.com  # default email address for the automated emails
# EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive (only set one of those to True)
EMAIL_USE_TLS=true  # use TLS (secure) connection with the SMTP server
EMAIL_USE_SSL=false  # use implicit TLS (secure) connection with the SMTP server

console works fine but smtp does not do anything. or i dont know if i have to rebuild the docker image from scratch with these settings to make it work.

anybody has an idea?

@Khyretos use True or False (with the first letter in uppercase) instead of true or false and try it again.

It seems to work now but i get this strange error. that it tries to send a mail to example@example.com

for example i implemented OIDC and it works but not flawelessly because when i register a user it fails first when sending a mail to example@example.com and then it sends a mail to the user. the user can then log in correctly.

is there a way to check or edit existing user? i do have to admit i have yet to create a superuser. i do not know if that is required or not. but to me it looks like somewhere in the smtp settings it is taking example@example.com as some kind of admin or something.