{
  "slug": "createtestharness-dispatches-email-handlers-3f7801dbf851",
  "title": "createTestHarness dispatches email handlers",
  "tools": [
    "wrangler"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-07-30T16:26:58.000Z",
  "announced_at": "2026-07-30T16:26:58.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When testing a Worker's `email()` handler with Wrangler 4.116.0, call `server.getWorker().email({ from, to, raw })` and inspect the returned outcome, rejection reason, forwards, and replies.",
    "examples": [
      "const result = await server.getWorker().email({ from: \"sender@example.com\", to: \"inbox@example.com\", raw: [\"From: Sender <sender@example.com>\", \"To: Inbox <inbox@example.com>\", \"Message-ID: <test@example.com>\", \"Subject: Test email\", \"\", \"Hello from the test harness\"].join(\"\\r\\n\") });\nexpect(result).toMatchObject({ outcome: \"ok\", forwards: [{ recipient: \"archive@example.com\" }], replies: [{ sender: \"inbox@example.com\", raw: expect.stringContaining(\"Thanks for your email\") }] });"
    ],
    "gotchas": [
      "Version: 4.116.0",
      "from (required): Sender email address for the dispatched message.",
      "to (required): Recipient email address for the dispatched message.",
      "raw (required): Raw email content, supplied as a string.",
      "Prerequisite: Use Wrangler 4.116.0 or later, where the release note adds email dispatch support to createTestHarness."
    ]
  },
  "why_it_matters": "Test a Worker's `email()` handler and inspect its outcome, rejection reason, forwarded messages, and replies.",
  "sources": [
    "https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.116.0"
  ],
  "rank": 0.98022,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v1+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "backfill-20261007",
    "verdict_id": "backfill-20261007:backfill-20261007-f1e107dbcc70560b-3:gate",
    "evidence_hash": "21327d556bd95f20d047f1d666f33d756d08482086b89545faf6f492e381951f"
  },
  "review": {
    "draft_hash": "b57f51c734eff0207e1b4d3922a73d6c672b0b737cf109a0d4ac5b19814619e0",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "backfill-20261007:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.98 >= 0.9; 2 needed) and Jev gave 0.80 (>= 0.6 needed)."
  }
}
