Troubleshooting
Troubleshoot email notification safeguards — Contact and Engagement Platform
Email notification safeguards protect private correspondence by separating message preparation, authorization, and outbound delivery. This guide covers diagnosing notification failures, enforcing recipient and privacy controls, reconciling transport outcomes, and recovering without duplicating messages or compromising communication records.
Application: Contact and Engagement Platform (Sustainable Catalyst Engagement Intake)
Component: Notifications and Communication History
Article type: Troubleshooting guide
Verification: Source-reviewed; synthetic offline tests passed; deployed acceptance pending
Estimated reading time: 16–19 minutes
Source baseline: Engagement Intake 3f246974276a5e582d09f8c48d21628b82626bc7 (August 8, 2026).
Saving a communication draft must not itself cause an outbound email. The harder operational problem is proving why a message was or was not sent, who authorized it, whether suppression was applied, and what the mail transport actually confirmed. This procedure preserves those boundaries without turning private correspondence into public diagnostic data.
1. Goal
Diagnose and recover when an email notification is unexpectedly sent, not sent, duplicated, suppressed, misaddressed, or misleadingly marked successful. Establish a defensible evidence trail from inquiry and draft revision through authorization, send attempt, transport outcome, and subsequent independent provider evidence.
Primary acceptance criterion: saving a draft produces no external send; each actual send has explicit authorization or an enabled automatic notification policy, an attributable audit history, a valid recipient and permission boundary, and a transport state not confused with confirmed delivery.
The reviewed code supports manual drafts, opt-in automatic notices and a WordPress wp_mail() transport. It does not read incoming mailboxes or establish downstream delivery merely because wp_mail() returns success. See Communication Operations and Notification Policy.
2. Requirements
Use a site owner or explicitly authorized administrator on an approved staging environment. Do not submit real email addresses, private case narratives, original message bodies, credentials, or mail-server logs to a public article, issue, or AI tool. Required evidence is limited to:
- Source repository/commit and installed plugin release; WordPress/PHP versions and enabled modules.
- The private inquiry ID, communication ID, state,
row_version,attempt_count, direction, template key/version, deduplication key (if applicable), and audit-event types. - The sender’s privacy state and
do_not_emailflag; reason and consent or lawful-basis records should be inspected only in the authorized system. - The actor’s effective WordPress capability, valid form nonce, explicit send confirmation, notification policy flag, and intended recipient classification.
- Transport outcome and time in UTC, a sanitized error code, provider request/message identifier when independently available, and an incident reference.
Do not use a production send as a health probe. The provided Python checker operates exclusively on synthetic JSON and has no network, mail, or WordPress dependencies.
3. Symptoms
| Observed symptom | First distinction | Where to inspect |
|---|---|---|
| A saved draft appears in an outbound mailbox | Distinguish save event from a later manual send or enabled automatic notification | Private communication history; draft_created, send_attempted |
| Approved/failed notice will not send | Check privacy suppression, recipient, sender configuration and lock | Transport error code and inquiry privacy state |
| Email says accepted but requester has nothing | accepted means WordPress transport acceptance, not delivery |
Provider bounce/quarantine/SPF/DKIM/DMARC evidence |
| Two messages for one event | Check automatic dedupe key, repeated trigger and transport ambiguity | Dedupe identity, communication IDs, attempts, provider events |
| Wrong address or confidential CC | Verify complete recipient set and inquiry association | Private draft revision, recipient review and CC list |
| Template renders blank or wrong details | Check active template, binding/revision and inquiry context | Template key/version; authorized private preview |
| Automatic reminder unexpectedly fires | Check feature flags, due times, cron scheduling and lock | Notification Policy settings and cron evidence |
| Events, status or row version disagree | Check optimistic locking and persistence around send transition | Communication audit trail and record revision |
| No notification but no logged error | Check enablement; dedupe might have returned an accepted/suppressed existing record | Deduplication lookup and notification creation events |
4. Cause
Failures commonly cluster into five causes, each requiring a different recovery path:
- Unauthorized or ambiguous command: a draft is saved, but the send action is absent or another integration calls the mailer outside the admin authorization pathway.
- Invalid audience or restricted processing: wrong inquiry, stale contact address, CC recipient, do-not-email, privacy restriction, missing external consent or inadequate lawful basis.
- Transport acceptance versus actual delivery:
wp_mail()may accept a message even when downstream routing, spam filtering, bounce, or remote rejection prevents delivery. - Concurrency or retry ambiguity: draft version conflict, five-minute send lock, repeated automatic trigger, failed notification reprocessing, or a response lost after the message was accepted.
- Misleading audit/formatting: missing attempt event, outdated template, stale admin view, incorrect time zone, or unsanitized diagnostic fields.
Source code visibly checks sender-address suppression when the recipient matches the canonical inquiry contact. Review alternative recipients and CC separately; do not assume every possible contact address inherits the same conditional check. This is a review point, not evidence of a deployed incident. ‘+link(‘mailer’,’Mailer send guards’)+’.
5. Procedure
- Classify the incident: unintended send, missing send, incorrect recipient, duplicate, suppressed, acceptance-only, or audit mismatch. Record when it was first observed in UTC.
- Stop further outbound activity: leave existing accepted/failed records intact; disable only the affected automation policy where justified. Do not delete historical communication rows or clear a lock solely to force a retry.
- Resolve identity: read the canonical inquiry, current privacy status, do-not-email, recipient set, communication ID, and editor revision in the private admin area.
- Reconstruct the path: review
draft_created/draft_updated,send_attempted,mail_transport_accepted,mail_transport_failedorsend_suppressedevents, with actor and attempt number. - Check authorization: manual send must pass
sc_intake_send_communications, a valid admin nonce, andconfirm_sendat the handler; automatic sends require an enabled policy and valid event trigger. - Compare local state and transport: determine whether
wp_mail()returned true, false or an ambiguous result; inspect independent provider logs only through authorized tools. - Run offline diagnostics: replace identifiers and emails with synthetic examples; execute the bundled checker and read each finding before repairing anything.
- Reconcile and retest: verify correct state and permissions from a fresh admin session; perform any authorized transport test only against an approved sink or test mailbox, never a real requester.
Operational boundary: a message draft can be sent manually through a separate privileged and confirmed action. It is not correct to say that all drafts must first be transitioned to approved: the inspected mailer explicitly allows draft, approved, and failed as sendable states. See ‘+link(‘communication-admin’,’admin send handler’)+’ and ‘+link(‘mailer’,’mailer’).’.
6. Troubleshooting
| Checkpoint | Positive evidence | Failure / next action |
|---|---|---|
| Draft-save isolation | Save event; status=draft; attempt_count=0 |
If send attempt exists, correlate actor, cron event and exact communication ID |
| Manual send authorization | Send capability, nonce and explicit confirmation recorded in approved private workflow | Do not retry without a complete authorization chain |
| Automated policy | Flag on, correct event, template active, stable dedupe key | Disable only affected policy; inspect existing notification record before re-trigger |
| Suppression | Private sender contact checked; privacy state active; not do-not-email | Stop sender-directed mail; review all recipients and CC |
| Transport trace | Attempt number; wp_mail result; sanitized wp_mail_failed code |
Classify timeout/unknown as ambiguous; no blind retry |
| Delivery evidence | Provider/bounce evidence independently reconciled | Do not change accepted to delivered without proof |
| Audit persistence | Send/accept/fail events and record state agree | Preserve evidence; owner reviews transaction failure or plugin logs |
| External state | No private body or identifiers in public summary / case metadata | Contain output and review disclosure scope |
7. Resolution
Do not erase communication history to repair a mismatch. Use the following bounded recovery approach:
- Draft only: leave it unsent; correct recipients/template in an authorized editor session using the current
row_version. Saving must generate only draft-related audit events. - Suppressed: maintain do-not-email or privacy restrictions until the accountable owner verifies any lawful change. Do not bypass suppression with alternate addresses or CC.
- Transport failed: after validating message identity, status, sender/recipient and provider evidence, permit a single authorized manual retry of the failed record. Reconcile attempt history afterward.
- Transport accepted or uncertain: do not resend just because the email has not arrived. Check mail provider logs, bounce events, inbox/quarantine and notification record; open an incident if status cannot be reconciled.
- Duplicate or disclosure incident: disable affected automation; preserve all message IDs and audit evidence; assess recipient exposure, required notifications, credential rotation and deletion only under approved retention/privacy procedures.
- Stale edit or send lock: reload state; investigate concurrent actors and original send attempt before relying on lock expiry. Clearing it without reconciliation can create a duplicate.
Manual notification transport tests are intentionally plain text and contain no inquiry data; they are a separate authorized action and a successful test means transport acceptance only. See ‘+link(‘notification-service’,’test_notification()’)+’.
8. Verification
Acceptance requires evidence for the actual deployed release; the following are not yet run against a deployed installation:
- Authorized user saves a synthetic draft; zero send attempts, no
wp_mailcall and an immutable private draft event. - Without send capability or valid nonce or confirmation, manual sending is denied and produces no outbound effect.
- Approved test mailbox accepts one reviewed send; event sequence and
attempt_count=1agree; the state isaccepted, notdelivered. - Suppressed, privacy-restricted, malformed-recipient and invalid-template paths fail without contacting transport.
- Automatic notifications remain inactive when their policy flags are off; when enabled in isolated staging, dedupe keys prevent duplicate authoritative messages.
- Repeated/ambiguous send attempts do not produce duplicate messages without explicit reconciliation and authorized human action.
- A refreshed admin session shows the same current state; private email addresses, subject/body and audit events are not exposed by public pages, APIs or logs.
- All 24 cases in the downloadable staging matrix have owner, expected behavior, evidence pointers, release SHA and a recorded pass/fail decision.
Offline tests validate the companion checker only. Do not mark this article production verified until these live gates have been independently recorded.
9. Read the communication state correctly
| State | Meaning | May be called delivered? |
|---|---|---|
draft |
Saved editable content; no outbound effect | No |
approved |
Authorized system notification prepared; may be eligible to send | No |
sending |
An attempt was recorded / transport being invoked | No |
accepted |
WordPress wp_mail() returned success |
No |
failed |
Transport attempt failed or was rejected locally | No |
suppressed |
Processing/privacy suppression prevented send | No |
received/recorded |
Inbound or manual interaction captured; not proof of automated email delivery | No |
canceled |
Record canceled; preserved for audit | No |
10. Authorization and human confirmation
The manual route is admin_post_sc_ei_send_communication, handled by SC_EI_Communication_Admin::handle_send(). It checks sc_intake_send_communications, a per-communication admin nonce, and confirm_send before calling SC_EI_Mailer::send(). Draft saving is a separate action guarded by sc_intake_compose_communications.
Important integration caveat: SC_EI_Mailer::send() is a service method, not itself a complete actor authorization endpoint. Any additional caller must retain equivalent authenticated capability, fresh state, confirmation and audit checks; code-level acceptance alone does not authorize an external message.
11. Automated notification policies
By default the notification policies are disabled in the inspected settings. The source contains opt-in sender acknowledgments, internal new-inquiry alerts, review reminders, follow-up reminders, lifecycle task reminders, and escalation alerts. Automatic creation calls create_system_notification() and uses a dedupe key. A saved system record may be sent when the policy and event trigger permit it.
Reminder operations also use a transient WordPress option lock. If a notice exists in accepted or suppressed state, create_and_send() returns without another send. Review other states, particularly failed/incomplete attempts, before re-firing the same event. A dedupe key alone does not prove exactly-once transport delivery.
Documentation: ‘+link(‘notification-policy’,’policy behavior’)+’; implementation: ‘+link(‘notification-service’,’service and cron hooks’)+’.
12. Recipient, consent and privacy boundaries
Check the authoritative inquiry’s contact_email, privacy_status and do_not_email before sender-facing communication. The mailer suppresses messages addressed to the canonical contact for restricted, erasure_requested and erased privacy states, or when do-not-email is set.
Do not treat those conditional checks as a blanket consent evaluation. Separate human review must confirm recipient identity, any CC recipients, lawfulness of communication, and the correct sender-facing purpose. Do not route a suppressed sender through a substitute address. For an unexpected notification, examine whether an alternate recipient or CC path bypassed the canonical-address comparison in the reviewed implementation.
Keep confidential documents in controlled storage; mail transport deliberately has no attachment argument. Review ‘+link(‘communications’,’private export and privacy guidance’)+’.
13. Reconcile retries and deduplication
For automated records, use the stable dedupe_key as a logical-notification identifier. For send attempts, use communication_id plus attempt_count, timestamp and provider evidence. A repeated cron trigger is not evidence of a second transport send until an additional send_attempted and transport record exist. Conversely, a lost response can hide a send.
The inspected mailer uses a five-minute option lock and permits retry from a failed record. The documentation states no automatic retry loop; an operator must still reconcile failed and ambiguous states before manually repeating a send. If the same automatic trigger fires while its record remains failed, investigate whether it could invoke the send path again; this is a staging check, not a verified production defect.
14. Inspect transport evidence without overclaiming
On attempted sends, the mailer records send_attempted, invokes wp_mail(), then records mail_transport_accepted or mail_transport_failed. Transport error codes may originate from the wp_mail_failed WordPress hook. A message fingerprint is computed after acceptance; it is not a delivery receipt.
If the recipient reports nonreceipt, confirm DNS SPF/DKIM/DMARC, transport/provider queue, bounce, quarantine, spam classification, and the provider’s message identifier via authorized operational tools. Do not conclude that the email was delivered, opened or read solely from local acceptance status.
15. Use the private administration workspace
Under the relevant private inquiry, open Notifications and Communication History. Inspect the current draft/message and related events. The admin offers history, drafts, failed, inbound, follow-up, notification, templates and policy views. The send handler requires a privileged user and checked confirmation; the notification test requires sc_intake_manage_notifications.
Private communications CSV exports include addresses and bodies. Do not attach the CSV to public support tickets or add it to a documentation notebook. Prefer listing sanitized status, type, attempt number, duration and error codes only. See ‘+link(‘communication-admin’,’administrative handlers’)+’.
16. Run a read-only WordPress environment check
# Execute only on an authorized staging host. Set the correct WP root.
WP_PATH="/path/to/approved/staging-wordpress"
wp --path="$WP_PATH" plugin list --status=active --fields=name,status,version
wp --path="$WP_PATH" cron event list --fields=hook,next_run_gmt,recurrence \
| grep sc_ei_notification_reminders || true
# These commands inspect plugin/cron metadata; they do not send email.
# Do not output the sc_ei_settings option: it may contain addresses or private configuration.
Check the configured cron lock, notification policy flags and sender configuration only through the authorized settings UI or a sanctioned redacted diagnostic procedure. Do not assume cron is disabled because its scheduled hook is not listed at one instant. An error in one dispatch can coexist with subsequent successful requests.
17. Run the synthetic offline checker
cd sc-email-notification-safeguards-troubleshooting
python3 -m unittest -v test_notification_evidence_checker
python3 notification_evidence_checker.py fixtures/safe_draft.json
python3 notification_evidence_checker.py fixtures/safe_manual_send.json
python3 notification_evidence_checker.py fixtures/unsafe_send.json
# The unsafe example exits 2 on blocked policy findings.
The checker uses invented example.test addresses and never invokes WordPress, wp_mail(), SMTP, Microsoft Graph or any external provider. The schema is a teaching fixture, not an existing Contact and Engagement API contract. Inspect the JSON findings rather than copying any real correspondence into a fixture.
18. Example: draft cannot imply a sent message
{
"communication": {
"id": 100, "inquiry_id": 15,
"channel": "email", "status": "draft",
"is_automated": false, "attempt_count": 0,
"recipient_email": "synthetic.sender@example.test",
"cc": []
},
"events": [{"type": "draft_created"}],
"transport": {}
}
In this schematic fixture a draft exists, the attempt counter is zero, no send attempt event exists, and there is no transport confirmation. A record containing draft and mail_transport_accepted simultaneously should trigger reconciliation—not a blind resend or immediate deletion.
19. Example: audit reconciliation query
-- Illustration ONLY. Table prefix varies. Use a read-only account and
-- the exact installed schema; never paste resulting PII into tickets.
SELECT c.id, c.inquiry_id, c.status, c.attempt_count,
c.row_version, c.is_automated, c.template_key,
c.template_version, c.provider,
c.accepted_at, c.failed_at
FROM wp_sc_ei_communications AS c
WHERE c.id = :authorized_communication_id;
-- Verify actual prefix and column names on approved staging before use.
-- Read communication-event types and attempt numbers separately;
-- do not export subject, body, or recipient email.
Database table and field names in this example are illustrative; inspect SC_EI_Database::table('communications') on the installed release. For least privilege, use the private administration interface where possible. Never run a mass update to force consistency.
20. Decision tree: send, suppress, or investigate
- Was there an explicit send action or enabled automatic trigger? If no, no outbound message should exist; search for other jobs/integrations and preserve a suspected-send incident.
- Is the sender subject to a privacy restriction or do-not-email? If yes, suppress and audit. Review CC and alternate-address paths.
- Did a valid send attempt occur? If no, troubleshoot authorization, template, recipient or lock; do not infer transport failure.
- Did
wp_mail()return false? Keep failed state; assess retry eligibility after checking provider. - Did
wp_mail()return true? Record only accepted. Seek independent provider evidence before claiming delivery. - Was the outcome interrupted or unknown? Stop retry; reconcile provider and audit history, then obtain authorized incident decision.
21. Escalation and incident containment
Escalate to the Contact and Engagement component owner when recipients were unauthorized, suppression was bypassed, unapproved automation fired, private content appeared in an email, or audit and transport outcomes cannot be reconciled. Include the installed code revision, sanitized request/incident ID, notification class, UTC occurrence window, status transitions, attempt counts, feature-flag state, and test evidence. Keep private case details in the approved incident system with restricted access.
If an actual privacy or security incident occurred, follow applicable incident and retention procedures, including formal assessment of recipient disclosure, affected data and any required notices. Do not assume that hiding a message in the admin UI retracts it from a mail provider.
22. Staging acceptance matrix and pass criteria
The download package contains staging-acceptance-matrix.csv with 24 negative and positive scenarios. None has been executed on the installed WordPress deployment. Owner signoff requires reproducible results for draft isolation, privileged manual sending, suppression, invalid contacts, deduplication, repeated triggers, accepted-versus-delivered distinction, ambiguous failures, audit retention, public projection and controlled recovery. For external tests, use only approved sink accounts.
23. Technical references and scope
The following references are pinned to the inspected Engagement Intake repository commit; they describe source implementation, not live service health. Relevant documents and files:
- Notification Policy — default-off automation, dedupe, sender test
- Communication Operations — state meanings and private history
- Communication admin — permission, nonce and send confirmation
- Notification service — scheduled/triggered messages, opt-in controls
- Mailer — suppression, lock, wp_mail acceptance, audit
- Communication repository — drafts, row locking, dedupe keys and events
- Communication schema — message types and statuses
- Settings — notification defaults and sender checks
- WordPress capabilities — authorized view, compose, send and notification control
- Source static checks — communications safety assertions
- Microsoft Graph is calendar-scoped, not an email transport for this workflow
Explicit limitations: Source revision from August 8, 2026; production plugin version, activation flags, installed schema, actual SMTP/transactional transport, consent implementation, mailbox delivery, bounce handling and external provider receipts have not been validated here. An offline passing fixture does not certify that any real email was sent or suppressed correctly.
