← All guides marginal.sh

Testing Post-Purchase Subject Lines with OpenAI Codex

Updated June 2026 · Hosted email MCP server

Post-purchase emails are some of your highest-engagement sends — but the subject line still decides who opens. This guide shows how to run a subject line test for post-purchase campaigns directly from OpenAI Codex using marginal, a hosted email MCP server built for AI agents.

Why test post-purchase subject lines

The window right after a purchase is full of intent. Order confirmations, shipping updates, and thank-you sequences see strong opens, which makes them ideal candidates for a subject line A/B test — small wording changes here compound across every order.

Common levers worth testing in post-purchase flows include order-number visibility, delivery-time framing, gratitude versus utility, and personalization with the product name. A disciplined subject line test removes the guesswork.

Connecting OpenAI Codex to marginal

marginal exposes four MCP tools — generate_variants, launch_test, get_results, and recommend_next — over a hosted endpoint at https://marginal.sh/mcp. Because it is fully hosted, there's no server to deploy and no ESP API keys to wire up; you authenticate with a Bearer API key (marg_live_...).

Once the server is registered in OpenAI Codex, you can drive the entire post-purchase experiment in plain language without leaving your workflow. See https://marginal.sh/mcp and the docs at https://marginal.sh/docs/ for the latest tool reference.

Running the post-purchase subject line test

A typical post-purchase workflow in OpenAI Codex moves through generation, launch, and measurement. Ask Codex to draft variants tuned to your order-confirmation tone, then launch a managed send and let marginal handle open and click tracking automatically.

When results stabilize, get_results reports within-test lift so you can see which subject line actually moved opens, and recommend_next suggests the follow-up variant to try.

Making AI agent email marketing repeatable

Because the loop lives inside OpenAI Codex, post-purchase subject line testing becomes a repeatable step rather than a one-off task. The same prompts and tool calls can be reused across product lines, seasonal campaigns, and confirmation versus thank-you sequences.

This is the practical shape of AI agent email marketing: the agent proposes, marginal tests and measures, and you keep the variants that earn higher opens — all backed by real lift metrics instead of intuition.

Get started with marginal

marginal is a hosted email marketing MCP server at marginal.sh. Sign up free, create an API key, and connect https://marginal.sh/mcp from Cursor, Codex, or Claude Desktop.

Documentation · Sign up · FAQ