notiflowsDocs
Channels & ProvidersEmail

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:

  1. A Mailgun account
  2. A verified sending domain
  3. Your private API key

Configuration

FieldRequiredDescription
API KeyYesMailgun private API key
DomainYesYour verified sending domain (e.g., mg.example.com)
RegionYesUS or EU — must match the region you selected when adding the domain
From EmailYesSender email address on your verified domain
From NameNoDisplay 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.

  1. Log in to the Mailgun dashboard
  2. In the left navigation, click Sending > Domains
  3. Click Add New Domain
  4. Enter your domain name — Mailgun recommends using a subdomain like mg.example.com to separate transactional email from your root domain's reputation
  5. 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
  6. Select a DKIM key length — 2048-bit is recommended
  7. 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:

RecordTypePurpose
SPFTXTAuthorizes Mailgun to send email from your domain
DKIMTXTTwo records that provide public keys for email authentication
MXMXOptional — enables Mailgun to receive bounces and complaints
Tracking CNAMECNAMEOptional — enables click and open tracking with your domain

Add the required records (SPF and DKIM) to your DNS provider:

  1. Copy the records from the Mailgun domain settings page
  2. Add them to your DNS provider
  3. 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

  1. In the Mailgun dashboard, click your account name in the top right corner
  2. Select API Security
  3. Under Mailgun API keys, your private API key is listed
  4. 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

  1. Navigate to Channels in your project
  2. Click Create Channel
  3. Select Email as the channel type
  4. Select Mailgun as the provider
  5. Paste your API Key
  6. Enter your verified Domain (e.g., mg.example.com)
  7. Select the Region that matches the region you chose when adding the domain in Mailgun
  8. Enter your From Email (must be on your verified domain) and optionally a From Name
  9. 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 notification
  • data.* - Custom payload passed when triggering the notiflow

On this page