Docker email not working when using null credentials

On docker when I try and send an email i see

./taiga-manage.sh test_emails myemail@me.com

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.

however if i do

curl --url ‘smtp://smtp.mysmtp.com:25’ --mail-from ‘taiga-noreply@whatever.com’ --mail-rcpt ‘myemail@me.com’ ^Cupload-file mailtest.txt --insecure

I receive the email as expected.

The smtp server is a local one that doesn’t require user/password this is my current config

# 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.mysmtp.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=taiga-noreply@whatever.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

Hi @stretch

you should try to set TLS connection to False

EMAIL_USE_TLS=False

According to the documentation:

Whether to use a TLS (secure) connection when talking to the SMTP server. This is used for explicit TLS connections, generally on port 587.

I hope this can help

Best regards.

@david.barragan thanks for that, i’ve updated the .env file how do i reload/restart it?

you can use restart, docker compose restart

if i comment out username and password in .env i get

WARN[0000] The "EMAIL_HOST_PASSWORD" variable is not set. Defaulting to a blank string.
WARN[0000] The "EMAIL_HOST_USER" variable is not set. Defaulting to a blank string.
WARN[0000] The "EMAIL_HOST_USER" variable is not set. Defaulting to a blank string.
WARN[0000] The "EMAIL_HOST_PASSWORD" variable is not set. Defaulting to a blank string.
WARN[0000] The "EMAIL_HOST_USER" variable is not set. Defaulting to a blank string.
WARN[0000] The "EMAIL_HOST_PASSWORD" variable is not set. Defaulting to a blank string.
WARN[0000] /home/hybrid/taiga-docker/docker-compose.yml: `version` is obsolete
WARN[0000] The "EMAIL_HOST_PASSWORD" variable is not set. Defaulting to a blank string.
WARN[0000] The "EMAIL_HOST_USER" variable is not set. Defaulting to a blank string.
WARN[0000] The "EMAIL_HOST_USER" variable is not set. Defaulting to a blank string.
WARN[0000] The "EMAIL_HOST_PASSWORD" variable is not set. Defaulting to a blank string.
WARN[0000] /home/hybrid/taiga-docker/docker-compose-inits.yml: `version` is obsolete
[+] Creating 1/0
 ✔ Container taiga-docker-taiga-db-1  Running                                                                                                                                                                                           0.0s
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'

and email is received but still errors as above

#EMAIL_HOST_USER= # user to connect the SMTP server
#EMAIL_HOST_PASSWORD= # SMTP user’s password

however after commenting that outand docker restart none of the existing projects show so i have to uncomment and restart again.