Mailchimp Transactional
Send through Mailchimp Transactional (Mandrill) with typed recipients, tags, and metadata, but no replyTo field.
The Mailchimp adapter calls the Mailchimp Transactional API, the API formerly known as Mandrill, with plain fetch. Unusually, the API key travels in the request body rather than a header, and recipients are a single typed list (to/cc/bcc entries) instead of separate arrays.
@opencoredev/email-sdk/mailchimpConfigure
Create a Transactional API key in the Mandrill dashboard (Settings → SMTP & API Info) and verify your sending domain.
import { createEmailClient } from "@opencoredev/email-sdk";
import { mailchimp } from "@opencoredev/email-sdk/mailchimp";
export const email = createEmailClient({
adapters: [mailchimp({ apiKey: process.env.MAILCHIMP_API_KEY! })],
});Prop
Type
Send
Mailchimp maps cc, bcc, headers, attachments, tags (values only), and metadata. sendAt maps to Mailchimp's send_at (a UTC timestamp), and Mailchimp only schedules email for accounts with a positive balance.
const result = await email.send({
from: "Acme <hello@acme.com>",
to: [{ email: "user@example.com", name: "Ada" }],
subject: "Your order has shipped",
html: "<p>Order ord_123 is on its way.</p>",
metadata: { orderId: "ord_123" },
tags: [{ name: "type", value: "shipping" }],
});
console.log(result.id); // Mandrill _id of the first recipient resultMandrill responds with one result per recipient; the normalized id and messageId come from the first result's _id. Each result also carries a per-recipient status (sent, queued, rejected). If a send succeeds but mail does not arrive, check result.raw during smoke tests, because a rejected status still counts as a successful API call.
No replyTo field
This adapter does not support replyTo; setting it throws an EmailValidationError before
any request is made. Set a Reply-To header instead: headers: { "Reply-To": "support@acme.com" }. See field support for the full matrix.
Verify from the CLI
MAILCHIMP_API_KEY="md-..." npx email-sdk doctor --adapter mailchimpMAILCHIMP_API_KEY="md-..." npx email-sdk send \
--adapter mailchimp \
--from "Acme <hello@acme.com>" \
--to user@example.com \
--subject "Mailchimp smoke test" \
--text "It works" \
--dry-runDrop --dry-run for one real send and check the per-recipient status in the output; Mandrill can accept the request and still reject the recipient.
