Mailgun sends it. Notifly decides when and to whom.
Connect your Mailgun account with your own API key and sending domain, on the US or EU endpoint, and the email steps of your Notifly workflows are sent through it: your domain, your Mailgun logs, your Mailgun plan.
Notifly handles the rest of the notification: one trigger for email, in-app, SMS, push and chat; digest, delay and throttle steps; subscriber preferences checked before each send; and an activity feed that records Mailgun's response.
What you need from Mailgun
These are the fields the dashboard asks for when you connect Mailgun, quoted from the create form.
| Field | Required | Stored | Notes |
|---|---|---|---|
| API Key | Required | Encrypted at rest | |
| Base URL | Optional | As entered | |
| User name | Required | As entered | |
| Domain | Required | As entered | |
| From email address | Required | As entered | Use the same email address you used to authenticate your delivery provider |
| Sender name | Required | As entered |
- Base URL. Empty means
https://api.mailgun.net; usehttps://api.eu.mailgun.netfor an EU account. No other host is accepted. - Domain. Every message is created on this sending domain.
- From email address and Sender name. Combined into
Sender name <address>on every email.
Connect Mailgun in the dashboard
- Sign in at app.notifly.io, open Integration Store in the sidebar and choose Connect Provider.
- In the Connect Integration sheet, open the E-Mail tab (or search across channels), find Mailgun and choose Connect.
- Pick the environment the integration belongs to. Development and Production keep separate integrations, so you can point each at a different Mailgun account or key.
- Fill in Delivery Provider Credentials with the fields in the table above, then choose Create Integration.
- A new integration starts switched on as both Active Integration and Primary Integration, so email steps in that environment send through Mailgun by default. If the environment already has a primary email integration, the dashboard asks before replacing it.
Trigger a Mailgun email from your code
Your backend triggers a workflow; Notifly renders the email step and sends it through Mailgun. The subscriber is created or updated from to on the way.
// npm install @notiflyio/api@0.1.26
import { Notifly } from "@notiflyio/api";
const notifly = new Notifly({ security: { secretKey: process.env.NOTIFLY_SECRET_KEY } });
await notifly.trigger({
workflowId: "order-shipped",
to: { subscriberId: "user_123", email: "ada@example.com" },
payload: { orderId: "A-1042", trackingUrl: "https://example.com/track/A-1042" },
overrides: {
// oTag reaches Mailgun as o:tag.
providers: { mailgun: { oTag: ["order-shipped"] } },
},
});Prefer plain HTTP? The same trigger is POST https://api.notifly.io/v1/events/trigger with an Authorization: ApiKey header and a body of { "name", "to", "payload" }.
What reaches Mailgun
- Mailgun's o: and t: options. Written in camelCase on the trigger and mapped to Mailgun's names, including
o:tag,o:tracking,o:deliverytime,o:require-tlsandt:version. - Headers. Custom headers go out as
h:fields; reply-to ash:Reply-To. - Recipients and files. Cc and bcc as comma-separated lists; attachments with a content id as inline parts, the rest as attachments.
- Per step, if you need it.
overrides.steps.<stepId>.providers.mailgunapplies to one email step and wins over the workflow-wide value.
What Notifly adds on top of Mailgun
Workflows around the send
One trigger runs a workflow: this provider’s step can sit beside in-app, email, SMS, push and chat steps, behind digest, delay and throttle steps.
Subscriber preferences, enforced at send
Before each step runs, the subscriber’s workflow and channel preferences are checked; an opted-out step is skipped and the reason is recorded.
An in-app Inbox next to it
The same workflow can write to the Notifly Inbox, a real-time in-app feed you embed with the React component or the JavaScript SDK.
Per-trigger provider parameters
Anything the trigger passes under overrides.providers.<provider id> is merged into the request Notifly sends to the provider, per workflow or per step.
Activity you can debug
Every message gets execution details in the activity feed, including the response or error the provider returned.
Secrets encrypted at rest
API keys, tokens and service accounts are stored encrypted with AES-256; new and re-saved credentials use authenticated AES-256-GCM. The table above marks which of this provider’s fields that covers.
Several accounts, one primary
Connect more than one account on this channel. The primary integration is the default; another active integration takes the send when its conditions match the subscriber or the tenant in the trigger’s context.
Go deeper in the docs
Frequently asked questions
Does Notifly work with Mailgun's EU region?
Yes. Set Base URL to https://api.eu.mailgun.net. Left empty, it defaults to https://api.mailgun.net. Those two hosts, over HTTPS, are the only base URLs Notifly accepts; anything else is refused before a request is made, so a mistyped URL cannot send your key elsewhere.
What goes in the Domain and User name fields?
Domain is the Mailgun sending domain Notifly posts every message to. User name is passed to Mailgun's API client as its username, alongside your API key, which is stored encrypted at rest.
Can I use Mailgun tags, tracking or scheduled delivery?
Yes, per trigger under overrides.providers.mailgun. Mailgun's option names contain a colon, so Notifly maps camelCase names onto them: oTag becomes o:tag, oTracking becomes o:tracking, oTrackingClicks becomes o:tracking-clicks, oDeliverytime becomes o:deliverytime, oTestmode becomes o:testmode and tVersion becomes t:version.
How are custom headers and reply-to sent to Mailgun?
Each custom header is sent as an h: field, so X-Campaign becomes h:X-Campaign. A reply-to address is sent as h:Reply-To, and it wins over a Reply-To header set another way.
Do inline images work through Mailgun?
Yes. Attachments that carry a content id are sent to Mailgun as inline parts, so images referenced by cid: render in the body; every other attachment is sent as a regular attachment.
Bring your provider account. Keep your sender reputation.
One POST /v1/events/trigger — email, SMS, push, in-app, and chat. 10,000 events a month, free.