MultiMail tools for the Vercel AI SDK. Give any AI agent the ability to send and read email through MultiMail.
npm install @multimail/ai-sdk ai zodimport { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { createMultiMailTools } from '@multimail/ai-sdk';
const tools = createMultiMailTools(process.env.MULTIMAIL_API_KEY!);
const { text } = await generateText({
model: openai('gpt-4o'),
tools,
maxSteps: 5,
prompt: 'Check my inbox for unread emails and summarize them.',
});import { streamText } from 'ai';
import { anthropic } from '@ai-sdk/anthropic';
import { createMultiMailTools } from '@multimail/ai-sdk';
const tools = createMultiMailTools(process.env.MULTIMAIL_API_KEY!);
const result = streamText({
model: anthropic('claude-sonnet-4-20250514'),
tools,
maxSteps: 5,
prompt: 'Reply to the latest email from alice@example.com saying thanks.',
});
for await (const chunk of result.textStream) {
process.stdout.write(chunk);
}| Tool | Description |
|---|---|
listMailboxes |
List all mailboxes on the account |
checkInbox |
List emails with filtering (status, sender, subject, direction, dates) |
readEmail |
Read full email content (markdown body, attachments, tags) |
sendEmail |
Send a new email with markdown body |
replyEmail |
Reply to an existing email (auto-threads) |
searchContacts |
Search contacts by name or email |
listPending |
List emails awaiting human approval |
decideEmail |
Approve or reject a pending email |
getThread |
Get all emails in a conversation thread |
tagEmail |
Add key-value tags to an email |
const tools = createMultiMailTools('mm_live_...', {
baseUrl: 'https://api-staging.multimail.dev', // optional: override API URL
});MultiMail enforces graduated trust through oversight modes. Depending on the mailbox configuration, outbound emails may require human approval before delivery. The listPending and decideEmail tools let agents participate in the approval workflow.
Learn more at multimail.dev/docs.
MultiMail handles regulatory compliance at the infrastructure layer — no SDK-side code changes needed:
- EU AI Act Article 50: Every AI-sent email includes a cryptographically signed
ai_generateddisclosure in theX-MultiMail-Identityheader - US State Laws: Maine, New York, California, Illinois — AI disclosure built into email delivery
- CAN-SPAM: Unsubscribe headers and physical address footers on all outbound email
- Formally Verified: Lean 4 proofs of identity header tamper evidence
See multimail.dev/use-cases/eu-ai-act-email-compliance for details.
MIT