Email SDK
Adapters

Mailgun

Configure the Mailgun Messages API adapter.

Mailgun logo
Mailgun
@opencoredev/email-sdk/mailgun
OfficialPayload-testedLive account required
Open website

Before live sends

Create a Mailgun API key for the sending domain and use the base URL for the domain region. EU domains need the EU API base URL; US domains use the default. Verify DNS and sender setup before treating a successful SDK call as production-ready delivery.

import { createEmailClient } from "@opencoredev/email-sdk";
import { mailgun } from "@opencoredev/email-sdk/mailgun";

const email = createEmailClient({
  adapters: [
    mailgun({
      apiKey: process.env.MAILGUN_API_KEY!,
      domain: process.env.MAILGUN_DOMAIN!,
    }),
  ],
});

Options

OptionTypeRequiredNotes
apiKeystringYesMailgun API key.
domainstringYesSending domain.
baseUrlstringNoDefaults to https://api.mailgun.net. Use the EU API base URL if your domain is in the EU region.
fetchtypeof fetchNoUseful for tests or custom runtimes.

Mailgun sends attachments as multipart form data. See field support for the full mapping.

On this page