Skip to content
Corex

NotificationDelivery

Corex\Forms\Submission\NotificationDelivery · class · Forms layer

The truthful outcome of one submission-notification attempt. It exists to stop the old habit of flattening every result into “sent”. The vocabulary is the canonical {@see MailResult} state set — reused, not reinvented — plus not_attempted (nothing was required or possible) and unavailable (a submission saved before delivery was tracked). Two rules it enforces by construction: - wp_mail() returning true maps to accepted, never sent: a transport taking a message is not proof it reached an inbox (FR-015). - the persisted projection carries only safe fields — no SMTP host, credential, path, or trace (FR-019). The safeReason comes from {@see MailResult::$message}, which its own contract guarantees secret-free.

notAttempted(string $reasonCode, string $reason): self

Section titled “notAttempted(string $reasonCode, string $reason): self”

rejected(string $reasonCode, string $reason): self

Section titled “rejected(string $reasonCode, string $reason): self”

Routing, policy, or configuration prevented an attempt — distinct from a failure of one (FR-014). Used when the routed path resolves a binding to no deliverable recipient.

wpMail(bool $accepted, string $attemptId, string $reason): self

Section titled “wpMail(bool $accepted, string $attemptId, string $reason): self”

The wp_mail() floor. A true return is acceptance for delivery — accepted, never sent.

A submission saved before delivery was tracked — honestly unknown, never assumed successful.

An attempt that was made and did not go. Not not_attempted (nothing was to be sent) and not unavailable (nobody knows): neither is a failure anyone can act on.