Repository navigation
Commit 0b8dbea
fix(plugin-email): the Send test email refusals name what the admin does on the page, not a request body (#25453)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuACdPWFJTLDcTrByFCHLzqb)_
Fixes #25424
Clause-②: no
Metadata-protocol: none
## What
Setup → Email → **Send test email** sends to the signed-in admin's own
address. When it cannot, three refusals in `resolveMailTestRecipient`
(`packages/plugins/plugin-email/src/email-plugin.ts`) told the admin to
pass "to" in the request body. The mail settings page has no recipient
field, so the admin could not follow that advice from the page.
Each refusal now keeps its opening and its "nothing was sent", and names
what the admin does on the page. The wording follows the SMS twin in
#25421 (`resolveSmsTestRecipient`):
| Case | Opening (unchanged) | New remedy |
|---|---|---|
| no signed-in user (in-process call) | `No recipient — nothing was
sent.` | Sign in as an admin whose account has an email address, then
press Send test email again. |
| account read fails | `Could not read your account's email address …` |
press Send test email again once your account can be read. |
| account has no email, or no row | `Your account has no email address
…` | Press Send test email while signed in as an admin whose account has
an email address. |
A `to` in the request body still wins, as before. The override is now
documented only in the function's TSDoc, for API callers.
No route, response shape, status or code changes. Only the message text
changes.
## Landing
- The landing is the file the claim names. The refusal strings and their
TSDoc are the only lines touched in `email-plugin.ts`. The live-status
registration (open PR #25448) and the `provider === 'log'` branch are
untouched.
- Repo-wide grep for the old strings (`pass "to"`, `in the request
body`, `to name a recipient`, `Add an email address to your account`,
`carries no signed-in`): the only hits were the three refusals
themselves. No doc, pin or other package quoted them. `content/docs` has
no copy of them. `packages/*/CHANGELOG.md` is release-owned and was not
searched for edits.
## Tests
- New `describe('served mail/test — the recipient refusals are admin
copy')` in `mail-test-recipient.pin.test.ts`. It drives the served `POST
/api/settings/mail/test` door (real `SettingsService`, real routes, real
handler). Each case asserts the following:
- the `400` + `SETTINGS_ACTION_FAILED` envelope;
- the message opening;
- the remedy;
- `nothing was sent` and `Send test email` are present;
- there is no `/api/`, no `request body` and no `pass "to"`;
- `sendMail` was never called.
- The cases are: no email address, missing account row, failed account
read, and the in-process call with no user.
- `pnpm --filter @objectstack/plugin-email test`: Test Files 36 passed
(36), Tests 675 passed (675). `pnpm --filter @objectstack/plugin-email
typecheck` (tsc + check:test-typecheck): exit 0. Lock VERDICT
command-exit 0 for both.
- Ablation (one-shot, `scripts/ablation-replace.mjs`). The failed-read
remedy was put back to the old `Pass "to" in the request body to name a
recipient.` text, and the mutation landed (anchor 1 -> 0). Result: `a
failed account read` went red with Tests 1 failed | 9 passed (10). The
file was restored (blob == HEAD, `git diff HEAD` empty).
## Acceptance notes
- None.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_016g7nYP9wdNx1GDa5XDr7Uy
Co-authored-by: Claude <noreply@anthropic.com>1 parent ab510f4 commit 0b8dbea
3 files changed
Lines changed: 75 additions & 5 deletions
File tree
- .changeset
- packages/plugins/plugin-email/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
191 | 198 | | |
192 | 199 | | |
193 | 200 | | |
| |||
198 | 205 | | |
199 | 206 | | |
200 | 207 | | |
201 | | - | |
202 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
203 | 211 | | |
204 | 212 | | |
205 | 213 | | |
| |||
212 | 220 | | |
213 | 221 | | |
214 | 222 | | |
215 | | - | |
| 223 | + | |
| 224 | + | |
216 | 225 | | |
217 | 226 | | |
218 | 227 | | |
219 | 228 | | |
220 | 229 | | |
221 | 230 | | |
222 | | - | |
| 231 | + | |
| 232 | + | |
223 | 233 | | |
224 | 234 | | |
225 | 235 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
0 commit comments