docs(test-infra): correct SMTP example — Basic auth, TlsMode None, container hostname

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.
This commit is contained in:
Joseph Doherty
2026-05-21 02:13:19 -04:00
parent c66ef71017
commit e58e038db9

View File

@@ -29,18 +29,30 @@ For `appsettings.Development.json` (Notification Service):
"Smtp": { "Smtp": {
"Server": "localhost", "Server": "localhost",
"Port": 1025, "Port": 1025,
"AuthMode": "None", "AuthMode": "Basic",
"Credentials": "test:test",
"TlsMode": "None",
"FromAddress": "scada-notifications@company.com", "FromAddress": "scada-notifications@company.com",
"ConnectionTimeout": 30 "ConnectionTimeout": 30
} }
} }
``` ```
Since `MP_SMTP_AUTH_ACCEPT_ANY` is enabled, the Notification Service can use any auth mode: > **`Server` host**: use `localhost` only when the Notification Service runs directly on
- **No auth**: Connect directly, no credentials needed. > the host. When it runs inside the docker cluster, set `Server` to the container name
- **Basic Auth**: Any username/password will be accepted (useful for testing the auth code path without a real server). > `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. - **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 API
Mailpit exposes a REST API at `http://localhost:8025/api` for programmatic access: Mailpit exposes a REST API at `http://localhost:8025/api` for programmatic access: