I've recently used the docker images provided for Taiga6 to run an instance using docker-compose on Ubuntu 20.04.
Everything seems to work fine, except that I can't seem to get email working quite right. I use Gmail for my company's email, foamfactory.io, but the gmail smtp relay seems to be... finicky at best.
I decided to try using https://github.com/bokysan/docker-postfix to have a simple SMTP relay set up as part of the docker-compose.yml file. I can get the email server to start fine, and it will send emails as expected when I connect to the taiga-back container, install cURL, and run the following command:
curl --url 'smtp://taiga-email:25' --mail-from 'taiga-noreply@foamfactory.io' --mail-rcpt 'jaywir3@gmail.com' --upload-file mail.txt --insecure
However, when I attempt to send an email from Taiga (for example, inviting a user), I get the following exception:
taiga-back_1 | ERROR:2021-02-10 17:42:49,044: Internal Server Error: /api/v1/memberships/4/resend_invitation
taiga-back_1 | Traceback (most recent call last):
taiga-back_1 | File "/opt/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
taiga-back_1 | response = get_response(request)
taiga-back_1 | File "/opt/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
taiga-back_1 | response = self.process_exception_by_middleware(e, request)
taiga-back_1 | File "/opt/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
taiga-back_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
taiga-back_1 | File "/taiga-back/taiga/base/api/viewsets.py", line 104, in view
taiga-back_1 | return self.dispatch(request, *args, **kwargs)
taiga-back_1 | File "/opt/venv/lib/python3.7/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
taiga-back_1 | return view_func(*args, **kwargs)
taiga-back_1 | File "/taiga-back/taiga/base/api/views.py", line 458, in dispatch
taiga-back_1 | response = self.handle_exception(exc)
taiga-back_1 | File "/taiga-back/taiga/base/api/views.py", line 456, in dispatch
taiga-back_1 | response = handler(request, *args, **kwargs)
taiga-back_1 | File "/taiga-back/taiga/projects/api.py", line 1078, in resend_invitation
taiga-back_1 | services.send_invitation(invitation=invitation)
taiga-back_1 | File "/taiga-back/taiga/projects/services/invitations.py", line 32, in send_invitation
taiga-back_1 | email.send()
taiga-back_1 | File "/opt/venv/lib/python3.7/site-packages/django/core/mail/message.py", line 306, in send
taiga-back_1 | return self.get_connection(fail_silently).send_messages([self])
taiga-back_1 | File "/opt/venv/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 103, in send_messages
taiga-back_1 | new_conn_created = self.open()
taiga-back_1 | File "/opt/venv/lib/python3.7/site-packages/django/core/mail/backends/smtp.py", line 70, in open
taiga-back_1 | self.connection.login(self.username, self.password)
taiga-back_1 | File "/usr/local/lib/python3.7/smtplib.py", line 697, in login
taiga-back_1 | "SMTP AUTH extension not supported by server.")
taiga-back_1 | smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported by server.
The configuration looks like the following inside of docker-compose.yml
:
EMAIL_BACKEND: "django.core.mail.backends.smtp.EmailBackend"
DEFAULT_FROM_EMAIL: "taiga-noreply@foamfactory.io"
...
services:
taiga-email:
build: ../docker-postfix
environment:
ALLOWED_SENDER_DOMAINS: "foamfactory.io"
RELAYHOST_TLS_LEVEL: "may"
ports:
- "1587:${EMAIL_PORT}"
networks:
- taiga
I previously had Taiga v5 set up on a host that provided its own email service. We'll call this server email.foamfactory.io. I augmented it so that it would accept connections from the new host server (on which I'm running the docker image for taiga6) and receive email. It does not use TLS, and does not require authentication (the only server that can forward email through it is the one on which the taiga6 docker container is running).
Even with this solution, I'm still getting the error smtplib.SMTPNotSupportedError: SMTP AUTH extension not supported. I'm a bit at my wits end, because I want to use Taiga6, but the conversion to this newer version requires me to send an email invitation so that I can verify the user account for which I want to use.
I guess what I'm wondering is how I can disable SMTP authentication in Django... I want to be able to use unauthenticated SMTP over non-TLS connections, from a specific server to another specific SMTP server.