@tpmjs/tools-agentmail
Send an email message from an inbox to a recipient with subject and body.
Test @tpmjs/tools-agentmail (sendMessage) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install @tpmjs/tools-agentmailpnpm add @tpmjs/tools-agentmailyarn add @tpmjs/tools-agentmailbun add @tpmjs/tools-agentmaildeno add npm:@tpmjs/tools-agentmailimport { sendMessage } from '@tpmjs/tools-agentmail';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { sendMessage } from '@tpmjs/tools-agentmail';
const result = await generateText({
model: openai('gpt-4o'),
tools: { sendMessage },
prompt: 'Your prompt here...',
});
console.log(result.text);(to: string, text: string, subject: string, inbox_id: string, cc?: string, bcc?: string, html?: string, labels?: string[]) => Promise<unknown>Available configuration options
inbox_idstringThe inbox ID to send from.
tostringRecipient email address.
subjectstringEmail subject line.
textstringPlain text email body.
htmlstringOptional HTML email body.
ccstringOptional CC recipients (comma-separated).
bccstringOptional BCC recipients (comma-separated).
labelsarrayOptional labels to apply to the message.
Schema extracted: 3/1/2026, 4:27:04 AM
AgentMail API tools for AI agents — create inboxes, send/receive emails, manage threads, drafts, and more.
npm install @tpmjs/tools-agentmail
Set the AGENTMAIL_API_KEY environment variable. Get your API key from AgentMail Dashboard.
export AGENTMAIL_API_KEY=your_api_key_here
import { createInbox, sendMessage, listMessages } from '@tpmjs/tools-agentmail'; // Create a new inbox for your AI agent const inbox = await createInbox.execute({ username: 'my-agent', display_name: 'My AI Agent', }); // Send an email const message = await sendMessage.execute({ inbox_id: inbox.inbox_id, to: 'recipient@example.com', subject: 'Hello from AI', text: 'This is an automated message from my AI agent.', }); // List received messages const messages = await listMessages.execute({ inbox_id: inbox.inbox_id, limit: 20, });
| Tool | Description |
|---|---|
| createInbox | Create a new email inbox with optional custom username and domain |
| listInboxes | List all email inboxes with pagination support |
| getInbox | Get details of a specific inbox by ID |
| deleteInbox | Delete an inbox and all its messages permanently |
| sendMessage | Send an email message with subject and body |
| replyToMessage | Reply to an existing email in a thread |
| listMessages | List email messages in an inbox with pagination |
| getMessage | Get full details of a specific message |
| listThreads | List email threads, optionally filtered by labels |
| getThread | Get a thread with all its messages |
| createDraft | Create an email draft for approval before sending |
| sendDraft | Send a previously created draft |
For detailed API documentation, visit AgentMail API Docs.
MIT
Downloads/month
97
GitHub Stars
15
Quality Score