One secured SMTP path, optional login, sender and reply address, failing health #3

Merged
libretech merged 1 commits from fix/smtp-relay into main 2026-10-15 10:43:11 +02:00
Owner

For libretech/mp#71 (order mail).

  • /v1/send/message always used implicit TLS and /v1/send/pdf always STARTTLS on the same SMTP_RELAY_PORT, so one of them failed whatever the port. Now one connection path with SMTP_RELAY_SECURITY (ssl / starttls / none, default by port). A failed STARTTLS is an error instead of a plain-text login.
  • Login only when username and password are both set, so a trusted relay works without credentials.
  • SMTP_FROM and SMTP_REPLY_TO; every mail gets Date and Message-ID.
  • /health answers 503 when the SMTP server refuses. In production it reported smtp_responding: false for 30 days while Docker showed healthy.
  • The old tests never ran (missing import, invalid test-client call); 8 new tests run in python:3.13.1-alpine3.20, and CI gets a test job.

Local: PYTHONPATH=src python -m unittest discover -s src/tests: 8 tests OK.

For https://git.librete.ch/libretech/mp/issues/71 (order mail). - `/v1/send/message` always used implicit TLS and `/v1/send/pdf` always STARTTLS on the same `SMTP_RELAY_PORT`, so one of them failed whatever the port. Now one connection path with `SMTP_RELAY_SECURITY` (`ssl` / `starttls` / `none`, default by port). A failed STARTTLS is an error instead of a plain-text login. - Login only when username and password are both set, so a trusted relay works without credentials. - `SMTP_FROM` and `SMTP_REPLY_TO`; every mail gets `Date` and `Message-ID`. - `/health` answers 503 when the SMTP server refuses. In production it reported `smtp_responding: false` for 30 days while Docker showed healthy. - The old tests never ran (missing import, invalid test-client call); 8 new tests run in `python:3.13.1-alpine3.20`, and CI gets a test job. Local: `PYTHONPATH=src python -m unittest discover -s src/tests`: 8 tests OK.
libretech added 1 commit 2026-10-15 10:41:50 +02:00
One secured SMTP path, optional login, sender and reply address, failing health
build / test (pull_request) Successful in 17s
build / build (pull_request) Successful in 18s
c8ff4ad01e
The message endpoint used implicit TLS and the PDF endpoint STARTTLS on
the same port, so one of them always failed. Both now share one
connection path with an explicit SMTP_RELAY_SECURITY, log in only with
credentials, and take SMTP_FROM and SMTP_REPLY_TO. /health answers 503
when the SMTP server refuses, so the container turns unhealthy instead
of looking fine. The old tests never ran; eight new ones do, in CI too.
libretech merged commit 2efca9415e into main 2026-10-15 10:43:11 +02:00
libretech deleted branch fix/smtp-relay 2026-10-15 10:43:11 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: libreshop/mail#3