Mailgun
Connect Mailgun to WasteNot to sync delivery, open, click, bounce, unsubscribe, and spam complaint events from your transactional and marketing email. These events power engagement-based audiences so you can target customers who are actually interacting with your email.
Prerequisites
- A Mailgun account with a verified sending domain
- An API key with read access to your domain's logs
- Whether your account is on Mailgun's US or EU region
Mailgun retains event logs for 30 days. WasteNot will start syncing from 30 days before you connect the data source and keep up with new events going forward.
Connecting Mailgun
Step 1: Create an API key
- Sign in to your Mailgun account
- Go to Settings → API Security
- Create a new API key (or copy an existing one) and keep it somewhere safe
Step 2: Connect Mailgun in WasteNot
- Add a new Mailgun data source in WasteNot
- Enter a Name
- Enter your Domain — the Mailgun sending domain whose events you want to sync (for example,
mg.example.com) - Choose your Region —
USorEU, matching the region your Mailgun account is in - Paste your API Key
- Click Connect
WasteNot will verify the credentials and begin syncing events.
What gets synced
WasteNot syncs the following Mailgun events for the sending domain you connect:
- Delivered — the message was accepted by the recipient's mail server
- Opened — the recipient opened the message
- Clicked — the recipient clicked a link in the message
- Bounced — the message permanently failed to deliver
- Dropped — Mailgun rejected the message before sending
- Unsubscribed — the recipient unsubscribed
- Complained — the recipient marked the message as spam
Each event is keyed by the recipient's email address, so you can build audiences that target (or suppress) customers based on their recent email engagement.
Frequently asked questions
Can I connect multiple Mailgun domains?
Yes. Add a separate data source for each sending domain you want to sync.
Why am I only seeing the last 30 days of events?
Mailgun's Logs API only retains events for 30 days. Any history older than that is not available from Mailgun and cannot be backfilled.
My data source shows "Failed" status
Common causes:
- The API key is invalid or has been rotated
- The API key doesn't have access to the domain you entered
- The region is set incorrectly (US vs. EU)
- The sending domain hasn't been verified in Mailgun
Check your Mailgun settings, or reach out to support@wastenot.io for help.