If you've read our pillar guide on AI agents and the Mailpro™ API, you already know why connecting an AI agent to an email API is the shortest path from "chatbot" to "digital teammate". This article goes deep on one specific API — the Mailpro™ Email API v2 — and walks through a working setup for both transactional and campaign sending, driven by Claude, GPT or any LLM that supports tool calling.
TL;DR
- Mailpro™ Email API v2 takes
IdClient+ApiKeyover HTTPS — no SDK needed.- The two endpoints you'll use most are
/send/sendmail.json(transactional) and/send/campaign.json(bulk).- Any tool-calling LLM can drive the API through a thin wrapper.
- Every endpoint is documented in 20+ programming languages on our developer portal.
AI-driven email: the use cases that matter
Smart order confirmations
Standard order confirmations are template-shaped. Your AI agent can do more: it can write a personal note ("Thanks for choosing the Blue XL, a customer favourite") and attach dynamic recommendations, then call the email API to dispatch the whole thing. You keep the reliability of a structured template, with the warmth of a human-written note.
Support auto-triage
When a ticket lands, the agent classifies it, drafts a reply and — if confidence is high enough — sends it directly. Low-confidence tickets get routed to a human. This hybrid model is exactly what production support teams are deploying today.
Digest generation
At scale, executives want summaries, not floods. An agent reads 40 invoices a day and emits one executive digest at 6 PM: "Today: 12 paid, 3 overdue, 2 flagged for review." One email, zero noise. The Mailpro™ Email API handles the delivery; the LLM handles the synthesis.
Setup in 5 minutes
1. Get your IdClient and ApiKey
Both sit in your Mailpro™ account under Settings → API access. IdClient is a numeric ID; ApiKey is a GUID. Keep the key secret — treat it like a password.
2. Sanity-check with /account/credits.json
Before wiring Claude, verify your credentials work:
curl "https://api.mailpro.com/v2/account/credits.json?IdClient=YOUR_ID&ApiKey=YOUR_API_KEY"
You should get a JSON payload with your remaining email credits. If you see a 401, check the key. If you see a 500, check our status page.
3. Explore the full reference
Every endpoint is documented — with request / response shapes and a live "try it" panel — on the Email API v2 reference. Open it in a second tab and keep it handy.
Step-by-step: have Claude send a transactional email
We'll use Anthropic's Claude for this example, but the same pattern works with OpenAI function calling or Gemini's tool use — the SDK changes, the architecture doesn't.
1. Define the tool schema
tools = [{
"name": "send_transactional_email",
"description": "Send a one-off email to a single recipient via Mailpro.",
"input_schema": {
"type": "object",
"properties": {
"to": {"type": "string", "format": "email"},
"subject": {"type": "string"},
"html": {"type": "string", "description": "Full HTML body"},
"from": {"type": "string", "description": "Validated sender address"}
},
"required": ["to", "subject", "html", "from"]
}
}]
2. Craft the system prompt
You are an assistant that helps customer-success agents draft and send
follow-up emails. When the human confirms, use the `send_transactional_email`
tool. Be concise, friendly, and always include a clear call-to-action link.
3. Parse the tool call and hit /send/sendmail.json
import requests, json, anthropic
def execute_tool(name, args):
if name != "send_transactional_email":
return {"error": "unknown tool"}
r = requests.post(
"https://api.mailpro.com/v2/send/sendmail.json",
params={"IdClient": MAILPRO_ID, "ApiKey": MAILPRO_KEY},
data={
"EmailTo": args["to"],
"Subject": args["subject"],
"Body": args["html"],
"EmailFrom": args["from"]
}
)
return r.json()
# Claude request/response loop with tool execution omitt-d "PlanDate=2026-05-01T09:00:00"
PlanDate is optional — omit it and the campaign goes immediately. Include it and Mailpro™ schedules the send for you. Good pattern: let the agent choose PlanDate based on the recipient's time zone.
Personalisation with placeholders
Placeholders like [FirstName] and [LastName] are standard; custom fields ([Field1], [Field2]…) map to your list's custom columns in the order you defined them. The agent doesn't need to know the values — just reference the placeholder in its generated HTML and the API fills them in per recipient.
Bulk import contacts from an agent upload
When the agent's first action in a workflow is "add 500 new leads", you don't want 500 individual API calls. Use the /import/upload.json endpoint we recently added:
curl -X POST "https://api.mailpro.com/v2/import/upload.json" \
-F "IdClient=YOUR_ID" \
-F "ApiKey=YOUR_API_KEY" \
-F "AddressBookId=42" \
-F "[email protected]" \
-F "WebhookUrl=https://example.com/hooks/import-done"
The endpoint queues the file for asynchronous processing and returns an ImportJobId immediately. When processing finishes, Mailpro™ POSTs a callback to your WebhookUrl with the final counts (imported / skipped / invalid). Full spec under the Import section of the Email v2 reference.
Code examples
Python
Minimal agent that drafts and sends a transactional email:
import anthropic, requests
client = anthropic.Anthropic(api_key="sk-ant-...")
resp = clientde>, RemainingCredits (not camelCase). If your agent parses responses, tell it so in the system prompt — otherwise it will hallucinate result and idSend.
-
Unsubscribed addresses are silently skipped. SetForce=1on/email/addonly when you have explicit consent; it bypasses the opt-out check, which is a GDPR risk otherwise. -
Rate limit is 500 requests/minute per key. Batch contacts into/email/add(bulk) rather than one/email/addSingleper contact. -
Stick to JSON. XML is supported (.xmlsuffix), but JSON is faster to parse and plays better with LLM tool output.
Case study (fictional): "NovaFit" — gym network with AI-personalised class reminders
NovaFit runs 40 gyms and sends class reminder emails 24 hours before each booking. Historically the reminders were templated ("Hi {first name}, your yoga class is tomorrow at 7 AM"). The growth team wired Claude behind their booking system: for each reminder, the agent read the member's workout history, their last-class notes, and the upcoming class type. Claude wrote one custom line ("Last time you nailed the warrior pose — ready to level up?") and posted the full email to Mailpro™ /send/sendmail.json. Open rates on reminders climbed from 46% to 63%. Show-up rate went up 8 points. Email volume didn't change; engineering time: half a day including testing.
Next step
The Email API v2 handles the sending side. If your agent also needs to manage contacts, tags, segments and custom fields, head over to our CRM v3 AI guide. For SMS, see the <a data-cke-saved-href="/blog/send-sms-ai-agent- href=" href="/blog/send-sms-ai-agent- href=" "="">