docker-cronicle-docker icon indicating copy to clipboard operation
docker-cronicle-docker copied to clipboard

Can't get email working

Open Snuffy2 opened this issue 1 year ago • 2 comments
trafficstars

I've been successfully running Cronicle in Docker for a couple of years and it works great!

I'm now trying to get email working for task failures and I can't seem to get the settings right. I've tried a number of different ways to set these but nothing seems to work. I'm sure my credentials are correct. From the error, I'm not convinced its even trying to login.

docker compose:

services:
  cronicle:
    depends_on:
      traefik:
        condition: service_healthy
    network_mode: service:vpn
    image: bluet/cronicle-docker:latest
    logging:
      driver: json-file
    container_name: cronicle
    environment:
      - TZ=$TZ
      - CRONICLE_base_app_url=https://cronicle.mydomain.com
      - [email protected]
      - CRONICLE_smtp_hostname=smtp.emailhost.com
      - CRONICLE_smtp_port=587
      - 'CRONICLE_mail_options={"secure": true, "auth": { "user": "snuffy2", "pass": "myverylongpassword_myverylongpassword_myverylongpassword_myverylongpassword_myverylongpassword" }, "connectionTimeout": 10000, "greetingTimeout": 10000, "socketTimeout": 10000}'
    healthcheck:
      test: curl --fail http://localhost:${CRONICLE_PORT} || exit 1
      interval: 180s
      retries: 5
      start_period: 120s
      start_interval: 30s
      timeout: 10s
    volumes:
      - $LOCALTIME
      - /var/run/docker.sock:/var/run/docker.sock:rw
      - ${APPDATA}/cronicle/data:/opt/cronicle/data:rw
      - ${APPDATA}/cronicle/logs:/opt/cronicle/logs:rw
      - ${APPDATA}/cronicle/plugins:/opt/cronicle/plugins:rw
      - ${APPDATA}/cronicle/app:/app:rw
    restart: unless-stopped
    labels:
      - autoheal=true
      - traefik.enable=true
      - traefik.http.routers.cronicle-int.priority=20
      - "traefik.http.routers.cronicle-int.rule=Host(`cronicle.$DOMAIN`) && $CLIENTIP_LOCAL_IPS"
      - traefik.http.routers.cronicle-int.entrypoints=websecure_7443
      - traefik.http.routers.cronicle-int.middlewares=chain-default@file
      - traefik.http.routers.cronicle-int.service=cronicle
      - traefik.http.routers.cronicle-ext.priority=10
      - "traefik.http.routers.cronicle-ext.rule=Host(`cronicle.$DOMAIN`)"
      - traefik.http.routers.cronicle-ext.entrypoints=websecure_7443
      - traefik.http.routers.cronicle-ext.middlewares=chain-organizr-auth@file
      - traefik.http.routers.cronicle-ext.service=cronicle
      - traefik.http.services.cronicle.loadbalancer.server.port=${CRONICLE_PORT}

Error:

cronicle  | [1731022462.28][2024-11-07 18:34:22][vpn][13][Error][error][mail][Failed to send e-mail for job: jm37y2rrw01: [email protected]: Error: Mail command failed: 502 5.7.0 Please authenticate first][{"text":"To: [email protected]\nFrom: [email protected]\nSubject: ⚠️ Cronicle Job Failed: Fail test\n\nDate/Time: 2024/11/07 18:34:21 (GMT-5)\nEvent Title: Fail test\nCategory: Healthchecks.io\nServer Target: All Servers\nPlugin: Test Plugin\n\nJob ID: jm37y2rrw01\nHostname: vpn\nPID: 34\nElapsed Time: 5 seconds\nPerformance Metrics: scale=1&total=5.115&db_query=0.149&db_connect=0.246&log_read=0.685&gzip_data=0.868&http_post=0.962\nAvg. Memory Usage: (Unknown)\nAvg. CPU Usage: (Unknown)\nError Code: 999\n\nError Description:\nSimulating an error message here.  Something went wrong!\n\nJob Details:\nhttps://cronicle.mydomain.com/#JobDetails?id=jm37y2rrw01\n\nJob Debug Log (5 K):\nhttps://cronicle.mydomain.com/api/app/get_job_log?id=jm37y2rrw01\n\nEdit Event:\nhttps://cronicle.mydomain.com/#Schedule?sub=edit_event&id=em37vlr7a01\n\nEvent Notes:\n(None)\n\nRegards,\nThe Cronicle Team\n"}]

Snuffy2 avatar Nov 07 '24 23:11 Snuffy2

As this is the upstream Chronicle feature described here https://github.com/jhuckaby/Cronicle/blob/master/docs%2FCommandLine.md

Can you try the following?

  1. Check the connection from inside the chronicle container to your smtp host:port
  2. Report it in Chronicle repo https://github.com/jhuckaby/Cronicle

bluet avatar Nov 09 '24 23:11 bluet

@Snuffy2 i've been using the email notification feature for a while now with https://github.com/ix-ai/smtp (it's basically a smtp bridge) and in config.json the following config

...
    "email_from": "[email protected]",
    "smtp_hostname": "smtp",  <-- `smtp` is the internal host of the container
    "smtp_port": 25,
...

i haven't tried yet, but in the same type of setup, you can also try https://github.com/YoRyan/mailrise or https://github.com/kenneth-church/junction and you can pretty much redirect smtp-notifications from cronicle to anywhere.

peterbuga avatar Dec 18 '24 08:12 peterbuga