bluet / docker-cronicle-docker

Scheduling dockerized Cronicle cron jobs run in docker container.
MIT License
108 stars 26 forks source link

Can't get email working #48

Open Snuffy2 opened 2 weeks ago

Snuffy2 commented 2 weeks ago

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
      - CRONICLE_email_from=cronicle@mydomain.com
      - 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: tv4vc710@email.com: Error: Mail command failed: 502 5.7.0 Please authenticate first][{"text":"To: tv4vc710@email.com\nFrom: cronicle@mydomain.com\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"}]
bluet commented 2 weeks ago

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