---
title: "Connect Flexmail to Claude: Send Emails and Track Performance"
slug: connect-flexmail-to-claude-send-emails-and-track-performance
date: 2026-10-01
author: Yuvraj Muley
categories: ["AI & Agents"]
excerpt: "Learn how to connect Flexmail to Claude using Truto's managed MCP server. Execute email campaigns, track delivery stats, and manage sender domains via AI."
tldr: "Connect Flexmail to Claude via Truto's managed MCP server. This guide details dynamic tool generation, how to map email schemas, handle Flexmail's specific domain verification logic, and execute complex workflows directly from Claude Desktop."
canonical: https://truto.one/blog/connect-flexmail-to-claude-send-emails-and-track-performance/
---

# Connect Flexmail to Claude: Send Emails and Track Performance

**Flexmail in Claude, in about a minute.** The best way to connect Flexmail to Claude is Elaichi: connect Flexmail to Elaichi once, then add Elaichi to Claude as a connector. Two steps, about a minute, with a 14-day free trial and no credit card required.

1. **Start your free trial.** Create your Elaichi account. 14 days free, no credit card required.
2. **Connect Flexmail.** Connect Flexmail once in Elaichi. Claude never gets more access than you have.
3. **Add Elaichi to Claude.** In Claude, open Customize, then Connectors, press Add and paste https://api.elaichi.ai/mcp. Sign in and approve.

[Start free on Elaichi, 14 days, no credit card required](https://app.elaichi.ai/signup?utm_source=truto.one&utm_medium=referral&utm_campaign=launchpad&utm_content=post_markdown&utm_term=flexmail) · [Flexmail on Elaichi](https://elaichi.ai/connectors/flexmail/?utm_source=truto.one&utm_medium=referral&utm_campaign=launchpad&utm_content=post_markdown&utm_term=flexmail)

*Building Flexmail into your own product? The guide below is for you.*

---

If your team needs to connect Flexmail to Claude to automate email marketing operations, manage sender identities, or analyze delivery statistics, you need a [Model Context Protocol (MCP) server](https://truto.one/what-is-mcp-and-mcp-servers-and-how-do-they-work/). This server acts as the translation layer between Claude's natural language tool calls and Flexmail's strict REST APIs. You can either [build and maintain this infrastructure yourself](https://truto.one/the-hands-on-guide-to-building-mcp-servers-for-ai-agents-2026/), or use a managed integration platform like Truto to dynamically generate a [secure, authenticated MCP server URL](https://truto.one/managed-mcp-for-claude-full-saas-api-access-without-security-headaches/). If your team uses ChatGPT, check out our guide on [connecting Flexmail to ChatGPT](https://truto.one/connect-flexmail-to-chatgpt-manage-delivery-and-domains/) or explore our broader architectural overview on [connecting Flexmail to AI Agents](https://truto.one/connect-flexmail-to-ai-agents-automate-email-lifecycles/).

Giving a Large Language Model (LLM) read and write access to a production email sending platform like Flexmail is a serious engineering challenge. You have to handle strict API token lifecycles, map nested JSON schemas to MCP tool definitions, and deal with Flexmail's specific domain verification state machines. Every time Flexmail updates an endpoint or changes a delivery status flag, you have to update your server code, redeploy, and test the integration.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Flexmail, connect it natively to Claude Desktop, and execute complex email delivery workflows using natural language.

> Want to give your AI agents secure, authenticated access to Flexmail and 100+ other SaaS APIs? Let's talk about managed MCP architecture.
>
> [Talk to us](https://truto.one/book-a-demo/)

## The Engineering Reality of the Flexmail API

A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, the reality of implementing it against a highly stateful API like Flexmail is painful. Flexmail is built for enterprise volume, enforcing strict rules around sender identities, bounce handling, and asynchronous event reporting.

If you decide to build a custom MCP server for Flexmail, you own the entire API lifecycle. Here are the specific challenges you will face:

**Sender Identity and Verification States**
You cannot simply hit a `POST /messages` endpoint and expect an email to send. Flexmail requires all senders to operate from a verified domain with proper SPF, DKIM, and DMARC alignment. An LLM has no concept of this lifecycle. If you expose raw endpoints, Claude might attempt to send an email from an unverified address, leading to persistent 403 or 400 errors. Your MCP layer must provide structured tools like `create_a_flexmail_sender` and handle the subsequent verification state polling so the model understands *why* a message cannot be sent immediately.

**Asynchronous Event Tracking vs LLM Context**
Flexmail's `/stats` endpoint provides aggregated data that updates at intervals - it is not real-time. If you want granular, real-time data on soft bounces, hard bounces, or link clicks, you must rely on Flexmail's webhooks. Webhooks require a publicly accessible receiver, meaning your MCP server must spin up listener endpoints, ingest payload data, and somehow store it in a way the LLM can query later. Worse, Flexmail automatically disables any webhook after 10 failed delivery attempts, meaning your MCP architecture requires health-checking mechanisms.

**Factual Note on Rate Limits**
When dealing with bulk email APIs, [rate limiting is a constant hurdle](https://truto.one/handling-api-rate-limits-and-webhooks-from-dozens-of-integrations/). *Truto does not retry, throttle, or apply backoff on rate limit errors.* When Flexmail returns an HTTP 429, Truto passes that error directly to the caller. Truto normalizes upstream rate limit info into standardized headers (`ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`) per the IETF spec. The caller (Claude Desktop or your custom agent framework) is entirely responsible for interpreting these headers and executing the appropriate retry and backoff logic.

## Generating the Truto MCP Server for Flexmail

Truto eliminates the need to manually code tool schemas for Flexmail. Instead of hand-coding OpenAPI-to-MCP mappings, Truto's integration engine [derives tools dynamically](https://truto.one/auto-generated-mcp-tools-for-ai-agents-a-2026-architecture-guide/) from the integration's resource configurations and documentation records. 

Each generated MCP server is scoped to a single integrated account. The URL contains a cryptographic token that routes requests securely without requiring the client to handle OAuth exchanges.

There are two ways to create this MCP server: via the Truto dashboard or programmatically via the API.

### Method 1: Creating via the Truto UI

For teams who want immediate access to Flexmail inside Claude Desktop, the dashboard is the fastest route:

1. Log into your Truto dashboard and navigate to the **Integrated Accounts** section.
2. Select your connected Flexmail account.
3. Click on the **MCP Servers** tab.
4. Click **Create MCP Server**.
5. You will be prompted to configure the server. You can limit the server to specific operations (e.g., selecting only `read` methods) or specify tool tags to restrict access.
6. Click **Generate** and copy the resulting MCP Server URL (e.g., `https://api.truto.one/mcp/a1b2c3d4e5f6...`).

### Method 2: Creating via the Truto API

For platform engineers embedding AI capabilities into their own infrastructure, you can generate MCP servers programmatically. This is useful for spinning up ephemeral MCP URLs scoped to individual user sessions.

Send a `POST` request to `/integrated-account/:id/mcp` with your configuration payload. 

```typescript
// Example: Creating a read-only MCP server for Flexmail
const response = await fetch('https://api.truto.one/integrated-account/<FLEXMAIL_ACCOUNT_ID>/mcp', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <YOUR_TRUTO_API_KEY>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: "Flexmail Analytics Agent",
    config: {
      methods: ["read"], // Restricts Claude to GET/LIST endpoints
      tags: ["reporting"] 
    },
    expires_at: "2026-12-31T23:59:59Z"
  })
});

const data = await response.json();
console.log(data.url); // https://api.truto.one/mcp/...
```

The Truto API validates that Flexmail has tools available, generates a random hex string, hashes it with HMAC, stores the metadata in a distributed KV store for low-latency routing, and returns the ready-to-use URL.

## Connecting the MCP Server to Claude

Once you have your Truto MCP URL, you must register it with your AI client. The MCP protocol relies on JSON-RPC 2.0 messages over HTTP POST. You can configure Claude Desktop using either the graphical interface or the underlying JSON config file.

### Method A: Via the Claude UI

If you are using an MCP-compatible UI (like the desktop app or specific web interfaces):

1. Open **Settings** -> **Integrations** (or **Connectors** depending on your client version).
2. Click **Add MCP Server** or **Add custom connector**.
3. Provide a name (e.g., "Flexmail Prod").
4. Paste the Truto MCP URL.
5. Click **Add**. Claude will perform a handshake (`initialize` request) to retrieve the tool capabilities.

### Method B: Via the Claude Desktop Config File

For developers managing environments programmatically, you can edit the `claude_desktop_config.json` file. Because Truto provides a hosted, remote HTTP endpoint rather than a local binary, you utilize an SSE (Server-Sent Events) bridge or a curl-based MCP wrapper. For standard remote setups, the configuration looks like this:

```json
{
  "mcpServers": {
    "flexmail_integration": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "--url",
        "https://api.truto.one/mcp/a1b2c3d4e5f6..."
      ]
    }
  }
}
```

*Note: Restart Claude Desktop after updating this file. Claude will automatically call the `tools/list` endpoint via the Truto router, dynamically unpacking the Flexmail schemas into its context window.*

## High-Leverage Flexmail Hero Tools

Truto parses Flexmail's documentation records to inject required properties, parse nested body schemas, and append pagination cursors automatically. Here are the highest-leverage tools available to Claude when connected to Flexmail.

### `list_all_flexmail_messages`

This tool retrieves messages sent via Flexmail. It allows Claude to filter by date range, recipient, sender, subject, tag, metadata, and event status. It returns critical delivery timestamps, including `delivered_at`, `soft_bounced_at`, and `hard_bounced_at`.

**Usage note:** Because this endpoint handles pagination (up to 500 records per page), Truto automatically injects `limit` and `next_cursor` fields into the tool schema, explicitly instructing Claude to pass cursor values back unchanged on subsequent calls.

> "Claude, pull the last 200 messages sent to our enterprise tag over the weekend and identify which ones recorded a hard bounce."

### `create_a_flexmail_message`

Sends a transactional or campaign email to a single recipient. The tool requires a recipient, sender (`from`), subject, and HTML content. It supports base64 attachment arrays up to 20MB, as well as placeholder substitutions.

**Usage note:** The LLM must construct a valid HTML payload. Truto's proxy API handles the 201 Created response, mapping the location headers back to the agent so it knows the specific `message_id` of the dispatched email.

> "Draft a welcome email for new user example@domain.com, use the Flexmail sender identity sales@ourcompany.com, and dispatch it via the create message tool with link tracking enabled."

### `get_single_flexmail_message_by_id`

Fetches the full lifecycle details of a specific message, including every event registered against it (opens, clicks, bounces).

**Usage note:** Useful for diagnostic workflows when a user complains about not receiving an email. Claude can pull the exact event timeline to determine if the message was rejected by the upstream ISP.

> "Look up message ID 987654321 and tell me the exact timestamp it was opened, and what links the user clicked."

### `list_all_flexmail_senders`

Retrieves the sender identities registered in the Flexmail account, including their `verified` status.

**Usage note:** Claude should always call this tool before attempting to dispatch an email to ensure the chosen `from` address is authorized. Only verified senders can successfully pass through the `create_a_flexmail_message` endpoint.

> "List all our registered Flexmail senders. Are there any pending verifications we need to warn the marketing team about?"

### `create_a_flexmail_sending_domain`

Registers a new sending domain in Flexmail, returning the DNS records required for SPF alignment and DMARC passes.

**Usage note:** This is a powerful infrastructure automation tool. Claude can provision a domain and output the exact TXT and CNAME records the IT team needs to apply to their DNS provider.

> "Register the domain 'updates.ourcompany.com' as a new sending domain in Flexmail and output the required SPF and DKIM records in a formatted table for our network admins."

### `list_all_flexmail_stats`

Fetches global message statistics for the entire account, filterable by date. Returns aggregates for sent, delivered, rejected, bounced, opens, and clicks.

**Usage note:** Claude can use this to generate weekly performance reports. Remember that these stats are updated at intervals by Flexmail, so they are suitable for trend analysis rather than real-time alerting.

> "Retrieve our global Flexmail sending stats for the last 30 days. Calculate our overall open rate and compare our soft bounce ratio to last month."

For the complete tool inventory and granular JSON schema details, visit the [Flexmail integration page](https://truto.one/integrations/detail/flexmail).

## Workflows in Action

With MCP providing a flat input namespace for query and body parameters, Claude can orchestrate complex, multi-step routines that previously required custom Python scripts.

### Workflow 1: Domain Provisioning and Diagnostic Setup

When onboarding a new brand or subsidiary, marketing needs a dedicated sending domain, and engineering needs [webhooks for monitoring](https://truto.one/handling-api-rate-limits-and-webhooks-from-dozens-of-integrations/). Claude can handle the entire setup.

> "We need to spin up a new email channel for 'marketing.newbrand.com'. Register the domain in Flexmail, create a sender identity for 'hello@marketing.newbrand.com', and register a webhook pointing to 'https://api.ourbackend.com/webhooks/flexmail' for bounce events."

1. **`create_a_flexmail_sending_domain`**: Claude registers the domain and stores the returned DNS configuration requirements.
2. **`create_a_flexmail_sender`**: Claude provisions the specific sender identity tied to that domain.
3. **`create_a_flexmail_webhook`**: Claude registers the webhook specifically subscribing to `hard_bounce` and `soft_bounce` events.

**Result:** Claude provides the user with a confirmation of the created assets and prints out the exact DNS records the user needs to paste into Route53 or Cloudflare to complete domain verification.

```mermaid
sequenceDiagram
  participant Claude as Claude Desktop
  participant Truto as Truto MCP Server
  participant Flexmail as "Flexmail API"

  Claude->>Truto: call create_a_flexmail_sending_domain
  Truto->>Flexmail: POST /sending-domains
  Flexmail-->>Truto: Return DNS requirements
  Truto-->>Claude: JSON result
  
  Claude->>Truto: call create_a_flexmail_webhook
  Truto->>Flexmail: POST /webhooks
  Flexmail-->>Truto: Return Webhook ID
  Truto-->>Claude: JSON result
```

### Workflow 2: Delivery Investigation

Customer Support escalates a ticket stating a VIP client is not receiving their invoices. Claude can autonomously investigate the delivery pipeline.

> "Support says client example@enterprise.com isn't getting our automated reports. Check their message history in Flexmail for the past week and diagnose the issue."

1. **`list_all_flexmail_messages`**: Claude filters messages where the recipient matches the provided email address.
2. **`get_single_flexmail_message_by_id`**: For any messages that show a `rejected_at` or `hard_bounced_at` timestamp, Claude pulls the granular event timeline.
3. **LLM Analysis**: Claude reads the event metadata to determine if the issue is a blocked IP, a strict DMARC failure on the client's end, or an internal suppression list problem.

**Result:** Claude drafts a technical summary for the support agent, explaining exactly why the email bounced and providing the SMTP error codes returned by the upstream mail server.

## Security and Access Control

Exposing an email platform to an AI agent carries risks. A hallucinating model could accidentally send bulk test emails to real customers or delete active webhooks. Truto's MCP architecture mitigates this at the server generation level:

*   **Method Filtering:** You can restrict a token to `methods: ["read"]`. This drops tools like `create_a_flexmail_message` from the generated list entirely. The LLM simply cannot see or execute write commands.
*   **Tag Filtering:** Limit the agent's scope to specific functional areas by passing tags like `["reporting"]` or `["administration"]` during token creation.
*   **`require_api_token_auth`:** By default, possessing the MCP URL grants access. Setting this flag to `true` forces a second authentication layer - the client must pass a valid Truto API token in the headers, ensuring only authenticated team members can leverage the MCP server.
*   **`expires_at`:** For temporary audits or contractor access, you can apply a strict ISO datetime expiration. Truto's backend schedules a Durable Object alarm to aggressively destroy the token and its associated KV cache the moment it expires.

## Moving Fast with Managed Integrations

Building an MCP server from scratch means dealing with protocol handshakes, pagination translation, rate limit normalization, and stateful tracking. When an upstream provider deprecates an endpoint, your custom integration breaks, taking your AI agent's capabilities down with it.

By leveraging Truto's documentation-driven tool generation, you outsource the API lifecycle. When Flexmail updates a schema, Truto's underlying integration definition updates, and the changes flow immediately into Claude's context window. Your engineering team focuses on building better prompts and orchestrating workflows, while Truto handles the plumbing.

Ready to stop maintaining integration code? Get your AI agents connected to production data safely and securely.

> Scale your AI product with secure, managed MCP infrastructure for Flexmail and beyond. Let's look at your architecture.
>
> [Talk to us](https://truto.one/book-a-demo/)
