Mailgun
Configure Mailgun as an email provider in Notiflows
Mailgun is an email API for sending, receiving, and tracking emails.
Prerequisites
Before configuring Mailgun in Notiflows, you need:
- A Mailgun account
- A verified sending domain
- Your private API key
Configuration
| Field | Required | Description |
|---|---|---|
| API Key | Yes | Mailgun private API key |
| Domain | Yes | Your verified sending domain (e.g., mg.example.com) |
| Region | Yes | US or EU — must match the region you selected when adding the domain |
| From Email | Yes | Sender email address on your verified domain |
| From Name | No | Display name shown to recipients (e.g., My App) |
Step 1: Add and verify a domain
Mailgun requires you to verify a sending domain by adding DNS records.
- Log in to the Mailgun dashboard
- In the left navigation, click Sending > Domains
- Click Add New Domain
- Enter your domain name — Mailgun recommends using a subdomain like
mg.example.comto separate transactional email from your root domain's reputation - Select your region:
- US — data stored in US data centers (
api.mailgun.net) - EU — data stored in EU data centers (
api.eu.mailgun.net), recommended for GDPR compliance
- US — data stored in US data centers (
- Select a DKIM key length — 2048-bit is recommended
- Click Add Domain
The region you choose is permanent for that domain. If you need to switch regions later, you'll have to add the domain again in the other region. Choose carefully based on where your recipients are located and your compliance requirements.
Mailgun provides DNS records to add:
| Record | Type | Purpose |
|---|---|---|
| SPF | TXT | Authorizes Mailgun to send email from your domain |
| DKIM | TXT | Two records that provide public keys for email authentication |
| MX | MX | Optional — enables Mailgun to receive bounces and complaints |
| Tracking CNAME | CNAME | Optional — enables click and open tracking with your domain |
Add the required records (SPF and DKIM) to your DNS provider:
- Copy the records from the Mailgun domain settings page
- Add them to your DNS provider
- Return to Mailgun and click Verify DNS settings
If your domain already has an SPF record, do not add a second one — DNS only allows one SPF record per domain. Instead, edit the existing record and add include:mailgun.org to it. For example: v=spf1 include:_spf.google.com include:mailgun.org ~all
DNS changes typically propagate within a few hours but can take up to 48 hours. Verified domains show a green Verified badge in the dashboard.
Step 2: Get your API key
- In the Mailgun dashboard, click your account name in the top right corner
- Select API Security
- Under Mailgun API keys, your private API key is listed
- Click the eye icon to reveal and copy it
You can also create additional API keys scoped to specific domains from this page by clicking Add new key.
Step 3: Set up in Notiflows
- Navigate to Channels in your project
- Click Create Channel
- Select Email as the channel type
- Select Mailgun as the provider
- Paste your API Key
- Enter your verified Domain (e.g.,
mg.example.com) - Select the Region that matches the region you chose when adding the domain in Mailgun
- Enter your From Email (must be on your verified domain) and optionally a From Name
- Save the channel
Templates
Email templates support three content types:
- Visual - Drag-and-drop editor for rich HTML emails
- HTML - Raw HTML with full control
- Plaintext - Simple text emails
Use Liquid templating for dynamic content:
Hi {{ recipient.first_name }},
{{ data.message }}Available variable contexts:
recipient.*- Recipient user data (first_name, last_name, email, etc.)actor.*- User who triggered the notificationdata.*- Custom payload passed when triggering the notiflow