taigaio / taiga-docker

Mozilla Public License 2.0
1.15k stars 293 forks source link

Email Function Not working! #80

Open AmoghSaxena opened 2 years ago

AmoghSaxena commented 2 years ago

The Setup is pretty Easy! but when I setup email and tried to invite members then that function is not working.

Here is my composefile

version: "3.5"

x-environment:
  &default-back-environment
  # Database settings
  POSTGRES_DB: taiga
  POSTGRES_USER: taiga
  POSTGRES_PASSWORD: taiga
  POSTGRES_HOST: taiga-db
  # Taiga settings
  TAIGA_SECRET_KEY: "taiga-back-secret-key"
  TAIGA_SITES_SCHEME: "http"
  TAIGA_SITES_DOMAIN: "localhost:9000"
  TAIGA_SUBPATH: "" # "" or "/subpath"
  Email settings. Uncomment following lines and configure your SMTP server
  EMAIL_BACKEND: "django.core.mail.backends.smtp.EmailBackend"
  DEFAULT_FROM_EMAIL: "noreply@realmx.space"
  EMAIL_USE_TLS: "True"
  # EMAIL_USE_SSL: "False"
  EMAIL_HOST: "<SOMETHING>"
  EMAIL_PORT: 587
  EMAIL_HOST_USER: "noreply@realmx.space"
  EMAIL_HOST_PASSWORD: "<PASSWORD>"
  # Rabbitmq settings
  # Should be the same as in taiga-async-rabbitmq and taiga-events-rabbitmq
  RABBITMQ_USER: taiga
  RABBITMQ_PASS: taiga
  # Telemetry settings
  ENABLE_TELEMETRY: "True"

x-volumes:
  &default-back-volumes
  - taiga-static-data:/taiga-back/static
  - taiga-media-data:/taiga-back/media
  # - ./config.py:/taiga-back/settings/config.py

services:
  taiga-db:
    image: postgres:12.3
    environment:
      POSTGRES_DB: taiga
      POSTGRES_USER: taiga
      POSTGRES_PASSWORD: taiga
    volumes:
      - taiga-db-data:/var/lib/postgresql/data
    networks:
      - taiga

  taiga-back:
    image: taigaio/taiga-back:latest
    environment: *default-back-environment
    volumes: *default-back-volumes
    networks:
      - taiga
    depends_on:
      - taiga-db
      - taiga-events-rabbitmq
      - taiga-async-rabbitmq

  taiga-async:
    image: taigaio/taiga-back:latest
    entrypoint: ["/taiga-back/docker/async_entrypoint.sh"]
    environment: *default-back-environment
    volumes: *default-back-volumes
    networks:
      - taiga
    depends_on:
      - taiga-db
      - taiga-back
      - taiga-async-rabbitmq

  taiga-async-rabbitmq:
    image: rabbitmq:3.8-management-alpine
    environment:
      RABBITMQ_ERLANG_COOKIE: secret-erlang-cookie
      RABBITMQ_DEFAULT_USER: taiga
      RABBITMQ_DEFAULT_PASS: taiga
      RABBITMQ_DEFAULT_VHOST: taiga
    volumes:
      - taiga-async-rabbitmq-data:/var/lib/rabbitmq
    networks:
      - taiga

  taiga-front:
    image: taigaio/taiga-front:latest
    environment:
      TAIGA_URL: "http://localhost:9000"
      TAIGA_WEBSOCKETS_URL: "ws://localhost:9000"
      TAIGA_SUBPATH: "" # "" or "/subpath"
    networks:
      - taiga
    # volumes:
    #   - ./conf.json:/usr/share/nginx/html/conf.json

  taiga-events:
    image: taigaio/taiga-events:latest
    environment:
      RABBITMQ_USER: taiga
      RABBITMQ_PASS: taiga
      TAIGA_SECRET_KEY: "taiga-back-secret-key"
    networks:
      - taiga
    depends_on:
      - taiga-events-rabbitmq

  taiga-events-rabbitmq:
    image: rabbitmq:3.8-management-alpine
    environment:
      RABBITMQ_ERLANG_COOKIE: secret-erlang-cookie
      RABBITMQ_DEFAULT_USER: taiga
      RABBITMQ_DEFAULT_PASS: taiga
      RABBITMQ_DEFAULT_VHOST: taiga
    volumes:
      - taiga-events-rabbitmq-data:/var/lib/rabbitmq
    networks:
      - taiga

  taiga-protected:
    image: taigaio/taiga-protected:latest
    environment:
      MAX_AGE: 360
      SECRET_KEY: "taiga-back-secret-key"
    networks:
      - taiga

  taiga-gateway:
    image: nginx:1.19-alpine
    ports:
      - "9000:80"
    volumes:
      - ./taiga-gateway/taiga.conf:/etc/nginx/conf.d/default.conf
      - taiga-static-data:/taiga/static
      - taiga-media-data:/taiga/media
    networks:
      - taiga
    depends_on:
      - taiga-front
      - taiga-back
      - taiga-events

volumes:
  taiga-static-data:
  taiga-media-data:
  taiga-db-data:
  taiga-async-rabbitmq-data:
  taiga-events-rabbitmq-data:

networks:
  taiga:
ghost commented 2 years ago

Same problem there and I am sure the EMAIL setting is correct.

When I try to sent a test email with the command "./taiga-manage.sh sendtestemail" it gives me the message "If you're reading this, it was successful." but nothig was successful.

With the command "./taiga-manage.sh check --deploy" I get the following:

`+ exec docker-compose -f docker-compose.yml -f docker-compose-inits.yml run --rm taiga-manage check --deploy Creating taiga-docker_taiga-manage_run ... done System check identified some issues:

WARNINGS: ?: (security.W001) You do not have 'django.middleware.security.SecurityMiddleware' in your MIDDLEWARE so the SECURE_HSTS_SECONDS, SECURE_CONTENT_TYPE_NOSNIFF, SECURE_BROWSER_XSS_FILTER, and SECURE_SSL_REDIRECT settings will have no effect. ?: (security.W003) You don't appear to be using Django's built-in cross-site request forgery protection via the middleware ('django.middleware.csrf.CsrfViewMiddleware' is not in your MIDDLEWARE). Enabling the middleware is the safest approach to ensure you don't leave any holes. ?: (security.W009) Your SECRET_KEY has less than 50 characters or less than 5 unique characters. Please generate a long and random SECRET_KEY, otherwise many of Django's security-critical features will be vulnerable to attack. ?: (security.W019) You have 'django.middleware.clickjacking.XFrameOptionsMiddleware' in your MIDDLEWARE, but X_FRAME_OPTIONS is not set to 'DENY'. The default is 'SAMEORIGIN', but unless there is a good reason for your site to serve other parts of itself in a frame, you should change it to 'DENY'.

System check identified 4 issues (0 silenced).`

Any support? It is very annoying...

yoelvd commented 2 years ago

I have the same issue, using docker image taigaio/taiga-back:latest. I set proper (already tested with another app) email settings inside docker-compose.yml and yet no email got sent.

George-Nat commented 1 year ago

+1

SubZr0 commented 1 year ago

+1

msiebke commented 1 year ago

+1 python manage.py sendtestemail example@domain.com works fine, but notifications dont work at all.

daniel-herrero commented 1 year ago

Hi @AmoghSaxena ,

After all your related inquiries, the first thing I did is to discard a real bug while sending emails in Taiga.

In order to achieve this, I have downloaded the latests published images for the stable branch (pruning the older ones), and I tried three different SMTP server configurations to validate it (AWS, Gmail and Mailtrap).   I can assure you that Taiga (in the 30-mins setup) is able to send emails with a proper configuration.

For documentation purposes, in order to help others, I left here the final working configurations I used in my trials:

#  MAILTRAP
EMAIL_BACKEND: "django.core.mail.backends.smtp.EmailBackend"
DEFAULT_FROM_EMAIL: "no-reply@taiga.io"
EMAIL_USE_TLS: "True"
EMAIL_USE_SSL: "False"
EMAIL_HOST: "sandbox.smtp.mailtrap.io"
EMAIL_PORT: 587
EMAIL_HOST_USER: "6032xxx"
EMAIL_HOST_PASSWORD: "cb8xxx"

#  GMAIL
EMAIL_BACKEND: "django.core.mail.backends.smtp.EmailBackend"
DEFAULT_FROM_EMAIL: "no-reply@example.com"
EMAIL_USE_TLS: "True"
EMAIL_USE_SSL: "False"
EMAIL_HOST: "smtp.gmail.com"
EMAIL_PORT: 587
EMAIL_HOST_USER: "daniel.herrero@kaleidos.net"
EMAIL_HOST_PASSWORD: "qgfxxx" (Google App password)

#  AWS
EMAIL_BACKEND: "django.core.mail.backends.smtp.EmailBackend" 
DEFAULT_FROM_EMAIL: "no-reply@taiga.io"
EMAIL_USE_TLS: "True"
EMAIL_USE_SSL: "False"
EMAIL_HOST: "xxx.amazonaws.com"
EMAIL_PORT: 587
EMAIL_HOST_USER: "AKxxx"
EMAIL_HOST_PASSWORD: "BFtxxx"

Discarding it's a bug, to trace your particular problem we would require more logs in order to offer you help.

Apart from the email configuration itself in the docker-compose.yml file (as you have already done), the most important clue is offered by the execution logs given by the 'taiga-back' service.

Can you provide us both the logs when Taiga starts (to verify every involved service has started properly), and the logs after you attempt to send a mail (for example when inviting a new member to join a project) ?

NOTE: You can start Taiga using docker-compose up instead of the ./launch-all.sh script to verify the logs in real-time.

Thank you in advance

ilyazheprog commented 3 months ago

Email Not Working

My settings
# Taiga's SMTP settings - Variables to send Taiga's emails to the users
EMAIL_BACKEND=console  # use an SMTP server or display the emails in the console (either "smtp" or "console")
EMAIL_HOST=smtp.timeweb.ru
EMAIL_PORT=587   # default SMTP port
EMAIL_HOST_USER=root  # user to connect the SMTP server
EMAIL_HOST_PASSWORD=  # SMTP user's password
EMAIL_DEFAULT_FROM=no-reply@ilyazheprog-taiga.ru
# 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
Also, here is the output:
root@jira:~/taiga-docker# ./taiga-manage.sh sendtestemail ilya_zhenetskij@vk.com
+ exec docker compose -f docker-compose.yml -f docker-compose-inits.yml run --rm taiga-manage sendtestemail ilya_zhenetskij@vk.com
WARN[0000] /root/taiga-docker/docker-compose.yml: `version` is obsolete 
WARN[0000] /root/taiga-docker/docker-compose-inits.yml: `version` is obsolete 
WARN[0000] Found orphan containers ([taiga-docker-penpot-frontend-1 taiga-docker-penpot-backend-1 taiga-docker-penpot-postgres-1 taiga-docker-penpot-exporter-1 taiga-docker-penpot-redis-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
[+] 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 14afa356fb05 on 2024-06-07 05:51:01.355534+00:00
From: no-reply@ilyazheprog-taiga.ru
To: ilya_zhenetskij@vk.com
Date: Fri, 07 Jun 2024 05:51:01 -0000
Message-ID: <171773946135.1.636564675228602354@14afa356fb05>

If you're reading this, it was successful.
-------------------------------------------------------------------------------
root@jira:~/taiga-docker# . / taiga-manage.sh check --deploy
-bash: .: /: is a directory
root@jira:~/taiga-docker# . /taiga-manage.sh check --deploy
-bash: /taiga-manage.sh: No such file or directory
root@jira:~/taiga-docker# ./taiga-manage.sh check --deploy
+ exec docker compose -f docker-compose.yml -f docker-compose-inits.yml run --rm taiga-manage check --deploy
WARN[0000] /root/taiga-docker/docker-compose.yml: `version` is obsolete 
WARN[0000] /root/taiga-docker/docker-compose-inits.yml: `version` is obsolete 
WARN[0000] Found orphan containers ([taiga-docker-penpot-frontend-1 taiga-docker-penpot-backend-1 taiga-docker-penpot-postgres-1 taiga-docker-penpot-exporter-1 taiga-docker-penpot-redis-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. 
[+] Creating 1/0
 ✔ Container taiga-docker-taiga-db-1  Running                              0.0s 
System check identified some issues:

WARNINGS:
?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems.
?: (security.W008) Your SECURE_SSL_REDIRECT setting is not set to True. Unless your site should be available over both SSL and non-SSL connections, you may want to either set this setting True or configure a load balancer or reverse-proxy server to redirect all connections to HTTPS.
?: (security.W009) Your SECRET_KEY has less than 50 characters, less than 5 unique characters, or it's prefixed with 'django-insecure-' indicating that it was generated automatically by Django. Please generate a long and random SECRET_KEY, otherwise many of Django's security-critical features will be vulnerable to attack.

System check identified 3 issues (0 silenced).

Using the following documentation: Timeweb Email Settings