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.

# 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='smtppro.zoho.com'  # SMTP server address
EMAIL_PORT=587   # default SMTP port
EMAIL_HOST_USER='notifications@mycompany.com'  # user to connect the SMTP server
EMAIL_HOST_PASSWORD='MYEMAILPASS'
EMAIL_DEFAULT_FROM='notifications@mycompany.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

This is the .env file config, but everytime I try to send a new member invite, it doesn’t work, the network tab gives me {“error”: “Server application error”}

When I try ./taiga-manage.sh test_emails myemail@gmail.com

#####
                <a href="//None/user-settings/mail-notifications" style="-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; color:#FFF; font-weight:bold; text-decoration:underline">Configure email notifications or unsubscribe</a>
                 • 
                <a href="https://tree.taiga.io/support/" style="-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; color:#FFF; font-weight:bold; text-decoration:underline">Taiga Support</a>
                 • 
                <a href="mailto:support@taiga.io" style="-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; color:#FFF; font-weight:bold; text-decoration:underline">Contact us</a>
                
            
        </td>
        
            <td valign="middle" class="social-links" style='-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; mso-table-lspace:0; mso-table-rspace:0; color:#f5f5f5; font-family:"Open Sans", Arial, Helvetica; font-size:10px; line-height:150%; padding-bottom:15px; padding-left:20px; padding-right:17px; padding-top:15px; vertical-align:middle; text-align:right' align="right">
                <a href="https://twitter.com/taigaio" title="Follow us on Twitter" style="-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; color:#9dce0a; font-weight:bold; text-decoration:underline; display:inline-block; margin-left:0.5em"><img src="/None:/None/static/emails/logo-twitter.png" style="-ms-interpolation-mode:bicubic; border:0; height:20px; line-height:100%; outline:none; text-decoration:none; width:auto" height="20" width="auto"></a>
                <a href="https://github.com/taigaio" title="Get the code on GitHub" style="-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; color:#9dce0a; font-weight:bold; text-decoration:underline; display:inline-block; margin-left:0.5em"><img src="/None:/None/static/emails/logo-github.png" style="-ms-interpolation-mode:bicubic; border:0; height:20px; line-height:100%; outline:none; text-decoration:none; width:auto" height="20" width="auto"></a>
                <a href="https://taiga.io" title="Visit our website" style="-ms-text-size-adjust:100%; -webkit-text-size-adjust:100%; color:#FFF; font-weight:bold; text-decoration:underline; display:inline-block; margin-left:0.5em"><img src="/None:/None/static/emails/logo-web.png" style="-ms-interpolation-mode:bicubic; border:0; height:20px; line-height:100%; outline:none; text-decoration:none; width:auto" height="20" width="auto"></a>
            </td>
        
    </tr>
</table>
<!-- // END FOOTER -->
                                </td>
                            </tr>
                        </table>
                        <!-- // END TEMPLATE -->
                    </td>
                </tr>
            </table>
        </center>
    </body>
</html>

--===============7177434540594643220==--

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

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 52, in handle
    membership.invited_by = get_user_model().objects.all().order_by("?").first()
    ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'invited_by'

Any idea how to solve this?

I tried changing the port to 465/587 and SSL/TLS true / false, vise versa.

Hi there!

I’m checking the code for the test_emails command.

Based on your error, you should have at least received an example registration email, is that correct?

The error seems to indicate as well that there is no membership on any project on your database. Have you created any project yet? If you have, you should at least have your own membership on a project.

Best regards!

Thanks for the reply

Yes, I should at least receive a test mail, I can’t really send new member invitation due to the mail failure I think

I do have a project and the user is already a member since I created that project!

So, you did not receive the example registration email, right?

It appears that there is an email sent in console above your error. If that is the case, that could indicate that the environment variables have not been loaded and it’s using the default console smtp backend.

Please try doing export $(cat .env) before launching ./taiga-manage.sh test_emails myemail@gmail.com` and let me know if that helps or throws a different error.

Best regards!

root@Taiga-Project:~# cd taiga/
root@Taiga-Project:~/taiga# export $(cat .env)
-bash: export: `#': not a valid identifier
-bash: export: `Taiga's': not a valid identifier
-bash: export: `-': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `"http"': not a valid identifier
-bash: export: `"https"': not a valid identifier
-bash: export: `(secured)': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `Taiga's': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `it'll': not a valid identifier
-bash: export: `(use': not a valid identifier
-bash: export: `""': not a valid identifier
-bash: export: `"/subpath")': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `(use': not a valid identifier
-bash: export: `"ws"': not a valid identifier
-bash: export: `"wss")': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `Taiga's': not a valid identifier
-bash: export: `-': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `Please,': not a valid identifier
-bash: export: `value!!': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `Taiga's': not a valid identifier
-bash: export: `-': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `user's': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `Taiga's': not a valid identifier
-bash: export: `-': not a valid identifier
-bash: export: `Taiga's': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `(either': not a valid identifier
-bash: export: `"smtp"': not a valid identifier
-bash: export: `"console")': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `EMAIL_USE_TLS/EMAIL_USE_SSL': not a valid identifier
-bash: export: `(only': not a valid identifier
-bash: export: `True)': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `(secure)': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `(secure)': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `Taiga's': not a valid identifier
-bash: export: `-': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `user's': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `Taiga's': not a valid identifier
-bash: export: `-': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `(in': not a valid identifier
-bash: export: `seconds)': not a valid identifier
-bash: export: `#': not a valid identifier
-bash: export: `Taiga's': not a valid identifier
-bash: export: `-': not a valid identifier

And then when I run testmail command, same error

I also made the same silly mistake which mentioned here

Hi there,

Yeah, sorry, I forgot about the comments. Still, it should have exported the rest of the variables. I tried with the console backend, and managed to make the command work by having a non-accepted invitation.

I’m not sure that this is an SMTP issue. Can you share what logs you get in Taiga backend when trying to invite someone?

Since I rebuilt containers, it’s working fine now

1 Like