Mail relay: review of 7d766b6 — R-1 to R-12, four mutations, two sentences

- R-1 a delivered token becomes the one in use only on 200 or a refusal given after authentication
- R-2 a token of another site is refused by what /v1/status says (access-key field, scripts); docs for staging
- R-3 the confirm route looks the nonce up first and counts only refused calls
- R-4 one budget of time per message (10 s, 30 s with files), enrolment and retries included
- R-5 'Disconnect' without the service's answer is not confirmed and keeps the token to try again
- R-6 no enrolment without the confirm route in the config
- R-7 half an SMTP set-up: one log line and a hint in the panel
- R-8 to R-10, R-12 docs; R-11 the last failure stays in the state block
- tests for redirect: manual, the candidate's nonce, the expectation taken back, one recipient only

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 22:07:10 +01:00
co-authored by Claude Fable 5.2
parent 0ee74ab2a4
commit a2b07b1dc1
23 changed files with 584 additions and 69 deletions
+11 -1
View File
@@ -20,6 +20,9 @@ type TransportIntegrations = {
}
const smtpConfigured = (s: TransportIntegrations) => Boolean(s.smtpHost && s.smtpUser && s.smtpPassword)
/** Some of server, user name and password are filled in, but not all: the SMTP server cannot be used. */
export const smtpIncomplete = (s: TransportIntegrations) => !smtpConfigured(s) && Boolean(s.smtpHost || s.smtpUser || s.smtpPassword)
let warnedSmtpIncomplete = false
/** Which transport a send takes. `none`: nothing is set up and the relay is switched off. */
export type MailTransport = 'graph' | 'none' | 'relay' | 'smtp'
@@ -156,7 +159,14 @@ export const mailAdapter =
const chosen = transportOf(settings)
// No SMTP server in the panel and no Graph: the Intecion Notifications Webservice.
if (chosen === 'relay') {return sendRelayWithPanel(payload, relayOptions()!, message, settings)}
if (chosen === 'relay') {
// Half an SMTP set-up was "not configured" before 1.17.0; now the mail leaves another way: say so once.
if (smtpIncomplete(settings) && !warnedSmtpIncomplete) {
warnedSmtpIncomplete = true
payload.logger.warn('[iapl] The SMTP settings in Site integrations are incomplete (server, user name and password are all needed), so e-mails go through the Intecion Notifications Webservice. Complete them to use the SMTP server, or empty them.')
}
return sendRelayWithPanel(payload, relayOptions()!, message, settings)
}
const useGraph = chosen === 'graph'
// "Graph" in the panel without its variables is reported only while SMTP carries the mail instead.