TandoorRecipes / recipes

Application for managing recipes, planning meals, building shopping lists and much much more!
https://docs.tandoor.dev
Other
5.13k stars 547 forks source link

SMTP eMail not working #3166

Open Eulenbaer opened 1 month ago

Eulenbaer commented 1 month ago

Issue

Although configured according to the official configuration guide (https://docs.tandoor.dev/system/configuration/#email), tandoor seems to be incapable of sending mails.

I cant make out any attempt of tandoor to actually send a mail.

Tandoor Version

1.5.17

OS Version

Synology DSM 7.2.1-69057 Update 5

Setup

Docker / Docker-Compose

Reverse Proxy

No reverse proxy

Other

No response

Environment file

SECRET_KEY_FILE=/run/secrets/SECRET_KEY
DB_ENGINE=django.db.backends.postgresql
POSTGRES_HOST=<IP>
POSTGRES_DB=tandoor
POSTGRES_PORT=5432
POSTGRES_USER=tandoor
POSTGRES_PASSWORD_FILE=/run/secrets/DB_USR_PWD
DEBUG=0
ENABLE_METRICS=0
ENABLE_SIGNUP=0
REMOTE_USER_AUTH=0
EMAIL_HOST=smtp.domain.tld
EMAIL_PORT=587
EMAIL_HOST_USER=<login>
EMAIL_HOST_PASSWORD=/run/secrets/SMTP_PWD
EMAIL_USE_SSL=1
DEFAULT_FROM_EMAIL=<login>
FDC_API_KEY=/run/secrets/FDC_API
ACCOUNT_EMAIL_SUBJECT_PREFIX=[Tandoor Receipes]

Docker-Compose file

version: "3"

secrets:
  SECRET_KEY:
    file: '/volume1/docker/tandoor_stack/_secrets/secret_key.txt'
  DB_USR_PWD:
    file: '/volume1/docker/tandoor_stack/_secrets/db_usr_pwd.txt'
  SMTP_PWD:
    file: '/volume1/docker/tandoor_stack/_secrets/smtp_pwd.txt'
  FDC_API:
    file: '/volume1/docker/tandoor_stack/_secrets/fdc_api.txt'

services:
  web_recipes:
    image: 'vabene1111/recipes:1.5'
    container_name: 'tandoor-recipes'
    hostname: 'tandoor_recipes'
    restart: 'always'

    networks:
      docker_30:
        ipv4_address: <ip>

    healthcheck:
      test: wget --no-verbose --tries=1 --spider http://localhost:8080 || exit 1
      timeout: 30s
      interval: 10s
      retries: 10

    volumes:
      - '/volume1/docker/tandoor_stack/tandoor/static:/opt/recipes/staticfiles'
      - '/volume1/docker/tandoor_stack/tandoor/media:/opt/recipes/mediafiles'

    secrets:
      - 'SECRET_KEY'
      - 'DB_USR_PWD'
      - 'SMTP_PWD'
      - 'FDC_API'

    env_file:
      - 'stack.env'

networks:
  docker_30:
    external: true

Relevant logs

No response

smilerz commented 1 month ago

email works - you have the mail server setup incorrectly. Without additional details can't really tell you what's wrong.

Eulenbaer commented 1 month ago

I tried Outlook and gmail SMTP servers. Same configuaration as for mail clients or other "mail senders". Heck, pretty much my whole IoT runs on gmail, just Tandoor doesn't want to play.

smilerz commented 1 month ago

I tried Outlook and gmail SMTP servers. Same configuaration as for mail clients or other "mail senders". Heck, pretty much my whole IoT runs on gmail, just Tandoor doesn't want to play.

if you don't want to share details I can't help you.

Eulenbaer commented 1 month ago

for example? What is it you might require to further diagnose the problem?

smilerz commented 1 month ago

the email host

Eulenbaer commented 1 month ago

mail.gmx.net

smilerz commented 1 month ago

This says the email port is 465

Eulenbaer commented 1 month ago

The GMX documentation says otherwise: https://hilfe.gmx.net/pop-imap/pop3/serverdaten.html Besides, both should work, and I tried both, SSL and TLS. Neither do work.

smilerz commented 1 month ago

SSL requires setting EMAIL_USE_SSL=1 if it is TLS you have to set EMAIL_USE_TLS=1 instead

Eulenbaer commented 1 month ago

Thats what the documentation requires and what I tried.

In short, I used TLS configuration with EMAIL_USE_TLS=1 and Port 587 and I tried SSL with EMAIL_USE_SSL=1 and Port 465. For gmail, Outlook and GMX respectively.

smilerz commented 1 month ago

The example you showed had SSL and port 587.

Did you rebuild the container between each configuration change?

Eulenbaer commented 1 month ago

Just reset the whole container. Removed files from media & static, repulled image, droped postgres table. Recreated container.

No change, mail still does not work.

Check from container via sh to ping google.de / mail.gmx.net, both resolved, both returned pong.

Where are log files of tandoor located? Do I need to switch to debug=1 to see some logs being generated?

smilerz commented 1 month ago

Just reset the whole container. Removed files from media & static, repulled image, droped postgres table. Recreated container.

No change, mail still does not work.

Check from container via sh to ping google.de / mail.gmx.net, both resolved, both returned pong.

Where are log files of tandoor located? Do I need to switch to debug=1 to see some logs being generated?

they are sent to std out - but smtp doesn't really generate any logs, so odds you see anything aren't super high, but possible!

InfAmoUsaeble commented 3 weeks ago

Just reset the whole container. Removed files from media & static, repulled image, droped postgres table. Recreated container. No change, mail still does not work. Check from container via sh to ping google.de / mail.gmx.net, both resolved, both returned pong. Where are log files of tandoor located? Do I need to switch to debug=1 to see some logs being generated?

they are sent to std out - but smtp doesn't really generate any logs, so odds you see anything aren't super high, but possible!

Is there a reason why it doesn't contain the SMTP communication? It would help a ton to know, where the settings are broken or missing, or even what the receiving mail server relay has to say =)

I also can't make mails work, so I too would love some logs <3

smilerz commented 3 weeks ago

It's not in the logs because no one has written any logging.

InfAmoUsaeble commented 3 weeks ago

Thanks, I figured out my problem - I was using portainer to run the docker-compose file, which then meant that data was not actually saved... I started it with the docker compose command instead and the same settings as previously - Now SMTP is sending without a problem and I actually have data after new deploys :D

You learn something every day, thanks for your time - I hope this system is as good or better than it seems <3