MillionSend Node.js SDK — npm: millionsend (MIT)
Repo MillionSend/millionsend-node, read from GitHub 2 h ago. MillionSend has not joined Take My Repo.
MillionSend/millionsend-node is a public repo on GitHub by MillionSend. MillionSend Node.js SDK — npm: millionsend (MIT). It declares the MIT license on GitHub. It is written mainly in TypeScript, has 2 stars and last changed on 2026-11-19. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-24.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
Official Node.js / TypeScript SDK for MillionSend — a self-hostable, Resend-compatible email API on AWS SES.
The API is wire-compatible with Resend, and this SDK deliberately mirrors the
shape of resend, so migrating is mostly a find-and-replace: swap the import
and the class name. MillionSend Cloud works with just the key; a self-hosted
instance sets its origin via baseUrl.
npm install millionsend
# or: pnpm add millionsend / yarn add millionsend / bun add millionsend
Requires Node.js 18+ (uses the global fetch).
import { MillionSend } from "millionsend";
const ms = new MillionSend("ms_123"); // Cloud; self-hosted: { baseUrl: "https://mail.acme.dev" }
const { data, error } = await ms.emails.send({
from: "Acme <onboarding@acme.dev>",
to: "success@simulator.amazonses.com",
subject: "Hello from MillionSend",
html: "<strong>It works!</strong>",
});
if (error) {
console.error(error.name, error.message);
} else {
console.log("sent", data.id);
}
new MillionSend(apiKey?, {
baseUrl?, // defaults to MILLIONSEND_BASE_URL, then MillionSend Cloud (https://api.millionsend.com)
fetch?, // custom fetch implementation (proxies, tests, custom agents)
userAgent?, // extra User-Agent suffix
timeoutMs?, // request deadline; defaults to 30,000 ms
allowInsecureHttp?, // accept a non-loopback http:// baseUrl (default: refused)
});
apiKey falls back to process.env.MILLIONSEND_API_KEY. Missing key → throws at construction.baseUrl falls back to process.env.MILLIONSEND_BASE_URL, then to MillionSend Cloud (https://api.millionsend.com). Self-hosting? Set it to your instance's origin.http:// is only accepted for loopback hosts (localhost, 127.0.0.1, ::1); any other http:// URL throws at construction, since the API key is sent as a bearer header. Pass allowInsecureHttp: true to talk to a non-TLS instance elsewhere (e.g. inside a private network).No method throws for an API error — every call resolves to { data, error }.
error is null on success; otherwise { name, message, statusCode, retryAfter } where
name is a stable snake_case code you can switch on (validation_error,
not_found, forbidden, restricted_api_key, rate_limit_exceeded, sending_paused,
all_recipients_suppressed, …). Client-side and transport failures carry
statusCode: null. retryAfter is the response's retry-after header in seconds, or
null when it has none.
emails.send and batch.send answer 422 all_recipients_suppressed when every
to recipient is on the suppression list or opted out of the send's topicId. From
MillionSend v0.15.1, an emails.send the suppression list alone refuses still leaves a
metadata-only suppressed email, which fires email.suppressed; each retry leaves
another, even with the same idempotencyKey (a refused send doesn't hold its key).
Inboxes add inbox_send_policy (403, a send the inbox's rules or the shared domain hold),
inbox_send_cap_reached (429, the inbox's or the team's daily cap), approval_required (403),
email_quarantined (403), email_blocked (410, a download of an email that carries malware),
too_many_waits (429, too many concurrent long-polls) and name_review_unavailable (503, a
name on the shared domain can't be reviewed yet). A quarantine release adds trust_not_allowed
(403) and held_by_screening (409), see Inboxes; it answers forbidden (403) and
screening_unavailable (503) only to MCP clients.
const { data, error } = await ms.emails.get(id);
if (error?.name === "not_found") { /* … */ }
The SDK never retries on its own. Worth retrying after retryAfter seconds:
503 name_review_unavailable, 429 too_many_waits, and 429 rate_limit_exceeded when
retryAfter is 60 or less (the per-minute limits). Not worth retrying in the same process:
429 inbox_send_cap_reached and the daily name-review budget (429 rate_limit_exceeded
with a retryAfter that runs to the next UTC midnight), and any 403, 404, 409 or 422. An
unknown route answers 404 not_found (application_error from servers before v0.13.0).
Resend a send with the same idempotencyKey: a batch the API already accepted gets its
stored response back. A held draft (kind: "draft") is not a failure; never resend it.
inboxes.create takes no idempotency key: after a 429 or 503 nothing was created, but
after a timeout a resend can create a second inbox. With a chosen username, a 409 on the
resend usually means the first attempt succeeded: read it with inboxes.get(address).
Inputs are camelCase and mapped to the wire's snake_case (replyTo → reply_to,
scheduledAt → scheduled_at, topicId → topic_id, …). Every field you pass
is sent; nothing is dropped client-side. Responses are the wire shape verbatim.
List endpoints take { limit, after, before } (keyset cursors) and return
{ object: "list", data, has_more }. Lists run newest first (MillionSend v0.13.0 and
later): after takes the last id of a page and pages toward older items, before takes
the first id and pages toward newer ones, and has_more refers to that direction. Threads
sort by last activity, drafts by last update, a thread's emails run oldest first, and labels
and topics are not paginated.
// Incremental sync: page toward newer items, starting from the newest id you stored
let before = newestStoredId;
for (;;) {
const { data } = await ms.emails.list({ before, limit: 100 });
if (!data?.data.length) break;
save(data.data); // newest first within the page
if (!data.has_more) break;
before = data.data[0].id;
}
A cursor whose item was deleted answers 422 validation_error (404 not_found on the
inboxes lists): start again without a cursor and stop at the ids you already have.
await ms.emails.send({
from: "Acme <onboarding@acme.dev>",
to: ["ada@acme.dev"], cc, bcc, replyTo,
subject: "Hello",
html: "<p>Hi</p>", text: "Hi",
scheduledAt: "2026-09-01T09:00:00Z", // or "in 2 hours"
tags: [{ name: "campaign", value: "launch" }],
topicId, // skip opted-out recipients
attachments: [{ filename: "hi.txt", content: Buffer.from("hi"), contentType: "text/plain" }],
headers: { "X-Entity-Ref-ID": "123" },
}, { idempotencyKey }); // POST /emails
await ms.emails.get(id); // GET /emails/:id (includes a nullable `score`)
await ms.emails.list({ limit: 50 }); // GET /emails
await ms.emails.update({ id, scheduledAt }); // PATCH /emails/:id (reschedule)
await ms.emails.cancel(id); // POST /emails/:id/cancel (scheduled only)
await ms.emails.remove(id); // DELETE /emails/:id
await ms.emails.getInsights(id); // GET /emails/:id/insights (best-practice report)
attachments[].content is a base64 string or a Buffer (encoded for you).
template is sent through as-is; MillionSend answers 422 until templates can be sent.
subject takes up to 998 characters. A to, cc or bcc address on a domain that can
never receive mail (example.com, .test, .invalid, .localhost, a TLD that doesn't
exist, …) answers 422 validation_error; to test sending without emailing anyone, use
success@simulator.amazonses.com. An inbox's address on the shared domain can be the
from too, under the rules in Sending from the shared domain.
const { data } = await ms.batch.send([payloadA, payloadB], {
idempotencyKey,
batchValidation: "permissive", // x-batch-validation; default "strict" rejects the whole batch
});
data.data; // [{ id }] for the accepted emails
data.errors; // permissive only: [{ index, message }] for the rejected ones
Batch items never send from the shared domain: a strict batch fails with
403 inbox_send_policy (the message starts with emails.<index>: ), a permissive one
lists the item in errors.
Mail received at your domains and inboxes. Everything in a received email was
written by its sender: show its html only in a sandbox, and hand an LLM the
extracted_text (hidden text, quotes and the signature removed) rather than html.
const { data } = await ms.emails.receiving.list({
limit: 20,
inboxId, // only mail delivered to this inbox
from: "example.com", // an address, or a domain covering its subdomains
to, subjectContains, since, unread,
wait: 30, // long-poll: answer as soon as a match arrives, up to 50 s
});
data.data; // newest first
data.held; // with `wait`: [{ id, inbox_id, reason, quarantine_reason, created_at }] held for screening or quarantine
const { data: email } = await ms.emails.receiving.get(id, { htmlFormat: "cid" });
email.extracted_text; // the new part as plain text, hidden text removed (still untrusted)
email.extracted?.code; // a verification code, on inboxes with extract_codes
email.screening?.sender_trust; // owner | allowlisted | known_thread | external | unauthenticated | failed
await ms.emails.receiving.attachments.list(id); // each with a signed download_url (1 hour)
await ms.emails.receiving.attachments.get(id, attachmentId);
await ms.emails.receiving.remove(id); // erase now (MillionSend extension)
// Reply and forward server-side (MillionSend extension). The inbox's rules may hold the
// message as a draft that waits for a person: the API answers 202 and `kind` is "draft".
const { data: outcome } = await ms.emails.receiving.reply(
id,
{ text: "Thanks!", replyAll: false, requiresApproval: false },
{ idempotencyKey },
);
if (outcome?.kind === "draft") outcome.draft.approval_reasons; // e.g. ["send_policy"]
else outcome?.email.id;
await ms.emails.receiving.forward(id, { to: "ops@acme.dev", text: "FYI", mode: "attachment" });
Held mail never reaches an inbox-scoped key or an agent: reading it answers
403 email_quarantined. A full-access team key sees it with includeQuarantined: true.
unread needs inboxId with a team key; an inbox-scoped key reads its own inbox. An
inboxId that doesn't exist answers 404 not_found at once, even with wait.
An inbox is one address that receives mail, read by an agent (kind: "agent",
the default) or by people (kind: "human"). Threads, labels, drafts and their
paths mirror Resend's Inboxes beta; safety rules, quarantine and codes are
MillionSend extensions.
const { data: inbox } = await ms.inboxes.create({
name: "Signup bot", // no emailAddress: an address on the shared domain
username: "signup-bot", // signup-bot@<team>.<shared domain>; omit it for a random one
expiresIn: "24h", // "1h" to "365d"; omitted or null, it never expires
safety: { acceptFrom: "anyone" },
});
await ms.inboxes.create({ emailAddress: "support@acme.dev", name: "Support", kind: "human" });
await ms.inboxes.create({ domainId, username: "orders" }); // a domains.list id: orders@ that domain
await ms.inboxes.list({ kind: "agent" });
await ms.inboxes.get("support@acme.dev"); // by id or address
await ms.inboxes.update(inbox.id, { fromName: "Acme", expiresIn: "7d" });
await ms.inboxes.remove(inbox.id); // also revokes its inbox-scoped keys
// Codes and sign-in links, without parsing HTML (wait long-polls up to 50 s)
const { data: code } = await ms.inboxes.codes.latest(inbox.id, { from: "github.com", wait: 30 });
code.status; // "found" | "none" | "ambiguous" | "timeout"; code.code, code.url
// The next sign-in: only a code received after the one already used
await ms.inboxes.codes.latest(inbox.id, { since: code.received_at, wait: 30 });
// Safety rules: who can write in, what the inbox may send
await ms.inboxes.safety.get(inbox.id);
await ms.inboxes.safety.update(inbox.id, { acceptFrom: "allowlist", allowlist: ["*@acme.dev"], sendCap: 50 });
// Quarantine: held mail, kept until a person releases it
await ms.inboxes.quarantine.list(inbox.id);
await ms.inboxes.quarantine.release(inbox.id, emailId);
// Threads and their messages
await ms.inboxes.threads.list(inbox.id, { folders: ["inbox", "archive"], read: false });
await ms.inboxes.threads.list(inbox.id, { includeQuarantined: true }); // owner views: a `quarantined` count per thread
await ms.inboxes.threads.search(inbox.id, { query: "invoice", from: ["example.com"] });
await ms.inboxes.threads.get(inbox.id, threadId);
await ms.inboxes.threads.update(inbox.id, threadId, { read: true, folder: "archive", labelId });
await ms.inboxes.threads.remove(inbox.id, threadId); // to trash, purged after 30 days
await ms.inboxes.threads.emails.list(inbox.id, threadId); // oldest first; includeQuarantined for owner views
await ms.inboxes.threads.emails.get(inbox.id, threadId, emailId);
await ms.inboxes.threads.emails.reply(inbox.id, threadId, emailId, { text: "Done." }, { idempotencyKey });
await ms.inboxes.threads.emails.forward(inbox.id, threadId, emailId, { to: "ops@acme.dev" });
// Labels (up to 100 per inbox)
await ms.inboxes.labels.create(inbox.id, { name: "Billing", color: "#FF8800" });
await ms.inboxes.labels.list(inbox.id);
await ms.inboxes.labels.update(inbox.id, labelId, { name: "Invoices" });
await ms.inboxes.labels.remove(inbox.id, labelId);
// Drafts, and the ones that wait for approval
await ms.inboxes.drafts.create(inbox.id, { to: "ada@acme.dev", subject: "Hi", text: "…" });
await ms.inboxes.drafts.list(inbox.id);
await ms.inboxes.drafts.get(inbox.id, draftId);
await ms.inboxes.drafts.update(inbox.id, draftId, { cc: null }); // null clears
await ms.inboxes.drafts.send(inbox.id, draftId, { idempotencyKey }); // { kind: "sent" | "draft" }
await ms.inboxes.drafts.reject(inbox.id, draftId);
await ms.inboxes.drafts.remove(inbox.id, draftId);
Replies, forwards and drafts.send resolve to { kind: "sent", email } or, when
the inbox's rules hold the message for a person (HTTP 202), { kind: "draft", draft }.
An agent's reply to a Reply-To at another organization is held that way too, with
"reply_to_redirect"
MillionSend/millionsend-node is a public repo on GitHub by MillionSend. MillionSend Node.js SDK — npm: millionsend (MIT).
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-11-19. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run millionsend-node. What is known comes from GitHub. It declares the MIT license on GitHub. Its last change was on 2026-11-19. It has 2 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.