# MailPreflight Email QA & Deliverability API (v1.0.0)

> Catch broken merge tags, Gmail 102KB clipping, Outlook CSS bugs, and spam triggers before your agent hits send.

Deterministic pre-send QA for outbound HTML emails: catches Gmail 102KB clipping, Outlook Word-engine & Gmail CSS incompatibilities, unmerged ESP placeholders, phishing/shortener link triggers, and generates clean plain-text MIME fallbacks at the edge.

## Why Agents Use This API Instead of DIY
Replaces brittle regexes and heavyweight headless browsers with a <15ms deterministic HTML/CSS & deliverability parser covering Outlook Word VML/ghost-table quirks, 6 ESP placeholder syntaxes, phishing host-mismatch checks, and RFC 5322 plain-text conversion.

## Connection & Payment (x402 Default + Optional Bearer API Key)
- **MCP Server (Streamable HTTP):** `https://mail-preflight.apikeg.com/mcp` (Registry ID: `com.apikeg/mail-preflight` — `initialize`, `tools/list`, `resources/*`, and `prompts/*` are free)
- **OpenAPI 3.1 Spec:** [openapi.json](https://mail-preflight.apikeg.com/openapi.json)
- **Full Schema & Examples:** [llms-full.txt](https://mail-preflight.apikeg.com/llms-full.txt)
- **RFC 9727 API Catalog:** [.well-known/api-catalog](https://mail-preflight.apikeg.com/.well-known/api-catalog)
- **x402 Bazaar Manifest:** [.well-known/x402.json](https://mail-preflight.apikeg.com/.well-known/x402.json)
- **MCP Discovery Manifest:** [.well-known/mcp.json](https://mail-preflight.apikeg.com/.well-known/mcp.json)
- **A2A Agent Card:** [.well-known/agent-card.json](https://mail-preflight.apikeg.com/.well-known/agent-card.json)
- **Primary Payment (Zero Signup):** Cloudflare Monetization Gateway (`HTTP 402` / `x402` v2 with USDC on Base).
- **Optional Monthly API Key:** Pass `Authorization: Bearer ak_live_...` ($5 / $20 / $50 monthly per-product Stripe plans at [apikeg.com/account](https://apikeg.com/account)).
- **Free Preflight:** Append `?dry_run=true` (or header `X-Dry-Run: true`) to validate any request payload at `$0.00` cost.

## Tools & REST Endpoints
- [`audit_email_template`](https://mail-preflight.apikeg.com/tools/audit-email-template.md) (`POST https://mail-preflight.apikeg.com/v1/audit-email-template`) — $0.003 USD per email template preflight audit (x402 instant micropayment): Runs a full pre-send deliverability, merge-tag, link-hygiene, Gmail 102KB clipping, and cross-client CSS compatibility audit (Outlook Windows, Gmail, Apple Mail Dark Mode) on an HTML email.
- [`extract_plain_text_fallback`](https://mail-preflight.apikeg.com/tools/extract-plain-text-fallback.md) (`POST https://mail-preflight.apikeg.com/v1/extract-plain-text-fallback`) — $0.001 USD per HTML-to-plain-text MIME fallback conversion (x402 instant micropayment): Converts an HTML email into a clean, RFC 5322-wrapped text/plain MIME companion, preserving CTA links inline as 'Label (https://...)' and stripping invisible &#847; / &zwnj; preheader padding hacks.

## Instant MCP Configuration
```json
{
  "mcpServers": {
    "mail-preflight": {
      "type": "streamable-http",
      "url": "https://mail-preflight.apikeg.com/mcp"
    }
  }
}
```

## Common Agent Use Cases
- HTML email preflight checker API
- check Gmail 102KB email clipping MCP
- Outlook HTML email CSS compatibility validator
- detect unmerged email template variables before send
- convert HTML email to plain text MIME fallback API
- cold outreach spam trigger checker MCP
