Send Email from a Node.js AI Agent
fetch() or the @mailsai/sdk package — your Node agent sends from its own address in minutes.
fetch() is enough
const res = await fetch( "https://api.mails.ai/v1/messages" , {
method: "POST",
headers: {
Authorization: `Bearer ${ process. env. MAILS_API_KEY}`,
"Content-Type": "application/json" ,
},
body: JSON. stringify({
agent: "hello",
to: "user@example.com" ,
subject: "Welcome aboard",
body_text: "Thanks for signing up — reply any time and I will read it.",
}),
});Prefer types? npm install @mailsai/sdk gives you the same calls with autocomplete; running an MCP-capable runtime instead of raw Node, use @mailsai/mcp-server and your agent gets send/read as tools with zero glue code.
An address the agent actually owns
Create an agent once and it keeps its address, its thread history, and its sender reputation — no shared From: pool, no borrowed human mailbox. Inbound mail is parsed and injection-scanned before your handler sees it. The free tier covers 3,000 emails and 3,000 inbound replies a month; Pro is $20 a month for 50,000 emails and 50,000 inbound replies.
Frequently asked questions
Is there an npm package?
@mailsai/sdk (TypeScript SDK) and @mailsai/mcp-server (MCP server for agent runtimes like Claude Code and Cursor) are both live on npm. Both are thin wrappers over the same REST API shown here.Can I use this with the Vercel AI SDK or OpenAI Agents SDK?
How do replies reach my agent?
Explore the product
Give your first agent an inbox
Free covers 3,000 emails and 3,000 inbound replies a month, with no card. Upgrade when your agents get busy.
Get your API key