From e58e038db92bf4876d0282c50ebd635bb12ff90f Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 21 May 2026 02:13:19 -0400 Subject: [PATCH] =?UTF-8?q?docs(test-infra):=20correct=20SMTP=20example=20?= =?UTF-8?q?=E2=80=94=20Basic=20auth,=20TlsMode=20None,=20container=20hostn?= =?UTF-8?q?ame?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The appsettings example used AuthMode 'None', which the delivery code (MailKitSmtpClientWrapper) rejects — only Basic and OAuth2 are valid. Switch to a working Basic config with Credentials and TlsMode None, and document that Server must be the container name scadalink-smtp when the Notification Service runs inside the docker cluster. --- docs/test_infra/test_infra_smtp.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/test_infra/test_infra_smtp.md b/docs/test_infra/test_infra_smtp.md index 76f72d4..a9dceab 100644 --- a/docs/test_infra/test_infra_smtp.md +++ b/docs/test_infra/test_infra_smtp.md @@ -29,18 +29,30 @@ For `appsettings.Development.json` (Notification Service): "Smtp": { "Server": "localhost", "Port": 1025, - "AuthMode": "None", + "AuthMode": "Basic", + "Credentials": "test:test", + "TlsMode": "None", "FromAddress": "scada-notifications@company.com", "ConnectionTimeout": 30 } } ``` -Since `MP_SMTP_AUTH_ACCEPT_ANY` is enabled, the Notification Service can use any auth mode: -- **No auth**: Connect directly, no credentials needed. -- **Basic Auth**: Any username/password will be accepted (useful for testing the auth code path without a real server). +> **`Server` host**: use `localhost` only when the Notification Service runs directly on +> the host. When it runs inside the docker cluster, set `Server` to the container name +> `scadalink-smtp` — the cluster compose stack and the infra compose stack share the +> `scadalink-net` network, so the container is reachable by name. + +The delivery service (`MailKitSmtpClientWrapper`) only accepts `Basic` or `OAuth2` — +there is no "no auth" mode — so the working config above uses `Basic`: +- **Basic Auth**: `MP_SMTP_AUTH_ACCEPT_ANY` makes Mailpit accept any `username:password`, + so use a throwaway value such as `test:test`. This exercises the real auth code path + without a real server. - **OAuth2**: Not supported by Mailpit. For OAuth2 testing, use a real Microsoft 365 tenant. +`TlsMode` **must** be `None`: Mailpit on port 1025 is plain SMTP and does not offer +STARTTLS. `StartTLS` or `SSL` would fail the connection. + ## Mailpit API Mailpit exposes a REST API at `http://localhost:8025/api` for programmatic access: