Docs Get key
All server guides
Email Providers

Send one message through the SendHog SDK

Use SendHog's native SDK, retain its message identifier, and handle an uncertain provider outcome without duplicating mail.

Reviewed

Use SendHog’s native SDK for a new integration. Complete domain verification first and provide SENDHOG_API_KEY, APP_FROM, and TEST_TO from secure runtime configuration. Replace all placeholders with an approved sender and controlled recipient before running any send.

Use the published client contract

Follow the installation/version instructions in the quickstart; its native JavaScript package is @sendhog/sdk. This example uses the documented native interface:

import { SendHog } from "@sendhog/sdk";
for (const key of ["SENDHOG_API_KEY", "APP_FROM", "TEST_TO"]) {
  if (!process.env[key]) throw new Error(`Missing ${key}`);
}
const client = new SendHog(process.env.SENDHOG_API_KEY);
const result = await client.send({
  from: process.env.APP_FROM,
  to: process.env.TEST_TO,
  subject: "SendHog controlled test",
  text: "A test of the approved application delivery path.",
});
console.log({ id: result.id });

Running the module sends real mail. Persist the application send intent and returned ID without logging secrets or message content.

Interpret the result correctly

SendHog documents that sending waits for its delivery provider’s acceptance, not final recipient delivery. Investigate a SendOutcomeUnknown result using message state/support before repeating the request; automatic replay risks duplicate mail.

Confirm the dashboard record and controlled recipient, then add signed feedback through the next guide. MailKite uses a separate SDK/account contract; do not silently fail over by sending the same message through both services.

References: sending quickstart and acceptance/outcome semantics.