Docs Get key
All server guides
Email Providers

Send application email with the MailChannels SDK

Use the current authenticated MailChannels client with Domain Lockdown and inspect its data/error result.

Reviewed

After domain authorization, install the SDK shown in the current Node.js quickstart: npm install mailchannels-sdk.

Provide the API key, approved authorized sender, and controlled recipient through secure runtime configuration. Executing this ES module sends real mail:

import { MailChannels } from "mailchannels-sdk";
for (const key of ["MAILCHANNELS_API_KEY", "APP_FROM", "TEST_TO"]) {
  if (!process.env[key]) throw new Error(`Missing ${key}`);
}
const client = new MailChannels(process.env.MAILCHANNELS_API_KEY);
const { data, error } = await client.emails.send({
  from: { email: process.env.APP_FROM },
  to: { email: process.env.TEST_TO },
  subject: "MailChannels controlled test",
  text: "A message from the account-authorized domain.",
});
if (error) throw new Error("Send failed; inspect a redacted provider error");
console.log({ accepted: Boolean(data) });

Verify authorization and delivery independently

Persist the intended send and available returned correlation before processing later events. Inspect account activity and the controlled inbox; API acceptance is not proof of inbox placement.

For Domain Lockdown, sender-domain, or recipient restrictions, fix account/DNS configuration instead of removing controls. An ambiguous timeout requires investigation before replay or fallback to another transport.

Use the next guide for authenticated delivery-event processing. MailKite is an alternative application transport with its own SDK/domain gates; a MailChannels key or authorization record does not authorize MailKite sending.