51 lines
2.3 KiB
Markdown
51 lines
2.3 KiB
Markdown
# Task 01 — SMTP / MailPit configuration
|
|
|
|
- **Status:** Done — 2026-08-20
|
|
- **Depends on:** —
|
|
- **Size:** S
|
|
|
|
## Goal
|
|
|
|
Make the existing `Mail/` infrastructure (already in the tree and registered in `Program.cs`) actually usable: add the missing `"Smtp"` configuration section so `MailSender` has a host, port, sender, and recipient.
|
|
|
|
## Context
|
|
|
|
- `plushealthtech/Mail/MailSender.cs` — sends via `SmtpClient`, `EnableSsl = false`, no credentials. **Do not recreate or rewire** — it is registered as a singleton in `Program.cs` from the `"Smtp"` section.
|
|
- `plushealthtech/Mail/SmtpOptions.cs` — `Host` (default `localhost`), `Port` (default `1025`), `From` / `To` (default empty → `MailSender` throws if submitted while empty).
|
|
- **No `"Smtp"` section exists in any appsettings file** — that is the gap.
|
|
|
|
## Files
|
|
|
|
- Modify: `plushealthtech/appsettings.json`
|
|
|
|
## Steps
|
|
|
|
1. Add this section to `plushealthtech/appsettings.json` (base config — the MailPit server is the same in every environment):
|
|
|
|
```json
|
|
"Smtp": {
|
|
"Host": "tools.host.domain",
|
|
"Port": 1025,
|
|
"From": "[email protected]",
|
|
"To": "[email protected]"
|
|
}
|
|
```
|
|
|
|
`From` is an assumption (MailPit does not validate the sender) — single point of change if a different sender address is wanted.
|
|
|
|
2. `dotnet build plushealthtech.sln` — must stay green (no code changes expected).
|
|
|
|
3. Confirm `tools.host.domain` resolves from this machine (`nslookup tools.host.domain` or `ping -n 1 tools.host.domain`). If it only resolves on the internal network, note that dev machines will need a hosts entry.
|
|
|
|
## Acceptance criteria
|
|
|
|
- [x] `appsettings.json` contains the `Smtp` section exactly as above.
|
|
- [x] Build green.
|
|
- [x] Host name resolution confirmed (or documented as internal-network-only).
|
|
- [ ] End-to-end delivery proven in Task 13 (form submit → message visible in MailPit for `alerts@plushealthtech.local`).
|
|
|
|
## Notes
|
|
|
|
- `From` empty would throw `ArgumentException` in `MailMessage` — this task removes that failure mode.
|
|
- Resolution check (2026-08-20): `tools.host.domain` resolves to `10.10.0.30` via the internal router DNS (`vrouter.home.domain`, 10.10.0.1) and answers ping; TCP port 1025 is open. It is **internal-network-only** — dev machines off that network will need a hosts entry for `tools.host.domain`.
|