Give AI agents their own email inboxes using the AgentMail API. Use when building email agents, sending/receiving emails programmatically, managing inboxes, handling attachments, organizing with labels, creating drafts for human approval, or setting up real-time notifications via webhooks/websockets. Supports multi-tenant isolation with pods.
95
93%
Does it follow best practices?
Impact
100%
1.07xAverage score across 4 eval scenarios
Advisory
Suggest reviewing before use
You are setting up the smallest truthful Node.js scaffold for an AgentMail draft workflow.
A teammate says there is already an environment variable named AGENTMAIL_KEY on the machine, but the workflow guidance you are following says the AgentMail SDK requires AGENTMAIL_API_KEY exactly unless there is explicit proof that another variable name is interchangeable.
The goal is to write a script that is honest about this boundary:
AGENTMAIL_API_KEY exactly for the real workflowAGENTMAIL_KEY is present nearby, treat it only as an unverified alias and warn about itAGENTMAIL_KEYWrite a single Node script named draft_scaffold.js that:
agentmailAGENTMAIL_API_KEY from the environment and exits with a clear non-zero failure if it is missingAGENTMAIL_KEY is present, prints a warning that it is only a nearby unverified alias and is not being used automaticallyAGENTMAIL_API_KEYclient.inboxes.drafts.create(inboxId, request)client.inboxes.drafts.send(inboxId, draft.draftId)Use these example values inside the scaffold:
inboxId = "agent@example.agentmail.to""macey@example.com""Draft pending approval""Hello from an offline AgentMail scaffold."Do not write tests or extra files.