- Email DIY
Intelligent Email Forwarding With Mailgun
We’ve recently been inundated with questions about how to track which email a recipient has replied to. There are many use cases for needing to do this. You may want to thread a conversation in your App or you may want to measure engagement. The problem with relying on Mailgun Tags or Campaign-IDs is that these are not standard MIME headers so the receiving email service provider (ESP) may strip them out.
The proper way to do this is to use the Message-ID header because when a recipient replies to an email the Message-ID of the original email is included in the In-Reply-To header of the reply.
Let’s walk through an example.
When you send an email using Mailgun, Mailgun automatically creates a Message-ID and includes it in the response (you could also set your own custom Message-ID).
So if I send a message using the messages API:
curl -s -k --user api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0
https://api.mailgun.net/v2/samples.mailgun.org/messages
-F from='Excited User <me@samples.mailgun.org>'
-F to='test <test@mailgunhq.com>'
-F subject='Hello'
-F text='Testing some Mailgun awesomness!'
Mailgun replies with:
"message": "Queued. Thank you.",
"id": "<20120502235917.29259.30669@samples.mailgun.org>"
You can see it in a screen shot of my terminal:
Now when I open that email in an email client and look at the email source headers, you can see that Message ID:
Ok, now let’s see what happens when I reply to that email. I created a Route in Mailgun that posts my reply to a URL at Postbin. Of course, Mailgun dutifully posts all of the headers. As you can see below, the In-Reply-To header has the same Message-ID which you then can use to identify which specific email was replied to:
So that’s it, an easy way to track who’s replying to what.
Happy emailing!
Mailgunners
Learn about our Deliverability Services
Looking to send a high volume of emails? Our email experts can supercharge your email performance. See how we've helped companies like Lyft, Shopify, Github increase their email delivery rates to an average of 97%.
Last updated on May 17, 2021
Intelligent Email Forwarding With Mailgun
Getting Started With Mailgun: An Introduction To The Platform
Inbound Email Routing In PHP
Open Sourcing Our Email Signature Parsing Library
Product Update: New Postbin For Debugging Webhooks
Store(): A Temporary Mailbox For All Your Incoming Email
Weekly Product Update: Inbound Emails And Self-Service Dedicated IPs
Agape Charity Finds Easy Way To Forward Email For Volunteers Worldwide
Weekly Product Update: Easy Testing For Routes Webhooks
Weekly Product Update: Better Handling Of Non-ASCII Characters In Routes
InboxReady x Salesforce: The Key to a Stronger Email Deliverability
Become an Email Pro With Our Templates API
Google Postmaster Tools: Understanding Sender Reputation
Navigating Your Career as a Woman in Tech
Implementing Dmarc – A Step-by-Step Guide
Email Bounces: What To Do About Them
Announcing InboxReady: The deliverability suite you need to hit the inbox
Black History Month in Tech: 7 Visionaries Who Shaped The Future
How To Create a Successful Triggered Email Program
Designing HTML Email Templates For Transactional Emails
InboxReady x Salesforce: The Key to a Stronger Email Deliverability
Implementing Dmarc – A Step-by-Step Guide
Announcing InboxReady: The deliverability suite you need to hit the inbox
Designing HTML Email Templates For Transactional Emails
Email Security Best Practices: How To Keep Your Email Program Safe
Mailgun’s Active Defense Against Log4j
Email Blasts: The Dos And Many Don’ts Of Mass Email Sending
Email's Best of 2021
5 Ideas For Better Developer-Designer Collaboration
Mailgun Joins Sinch: The Future of Customer Communications Is Here
Always be in the know and grab free email resources!
By sending this form, I agree that Mailgun may contact me and process my data in accordance with its Privacy Policy.