Skip to content
You're viewing documentation for v0.6.2. It may be out of date.Go to latest
Email SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

Mailgun

Send through the Mailgun Messages API with domain-scoped multipart sends, h:/v:/o: field mapping, and full field support.

The Mailgun adapter calls the Mailgun Messages API over fetch — no extra dependency. It is the one adapter that posts multipart form data instead of JSON, using Mailgun’s prefixed field names: h: for headers, v: for metadata variables, o: for sending options. Every send is scoped to the domain you configure.

Mailgun logo
Mailgun@opencoredev/email-sdk/mailgun
Provider docs

Configure

Grab an API key from the Mailgun dashboard and note the sending domain it belongs to — both are required.

PropType
apiKeystring

Mailgun API key, sent as Basic auth (api:key).

Typestring
domainstring

Sending domain. Requests go to /v3/{domain}/messages.

Typestring
baseUrl?string

Override the API origin, e.g. for the EU region.

Typestring
Default"https://api.mailgun.net"
fetch?typeof fetch

Custom fetch implementation for tests or special runtimes.

Typetypeof fetch

Send

Mailgun maps every common field: cc, bcc, replyTo, headers (as h:Name), attachments (multipart attachment/inline parts by disposition), tags (values as o:tag), and metadata (as v:key variables, surfaced later in webhooks and logs).

The response id is Mailgun’s queued message id from the response body — match it against delivery events in webhooks or the Mailgun logs.

Verify from the CLI

Credentials also work as flags: --api-key, --domain, and --base-url (or MAILGUN_BASE_URL) override the environment. Drop --dry-run for one real send — that is the only check that proves the domain’s DNS and the account are ready.

Last updated on