- What's new
Continuing Our Commitment: HTTPS Innovation And Optimization
This week, we’ve rolled out an enhancement, ok, we’ve fixed a bug, in our email parsing API, which is part of our incoming email handling system called Routes. Routes are one of our most popular features because it allows you to handle all those replies to your marketing and transactional emails. Some customers also use this incoming email handling feature to do cool things like let their customers use email to create tasks in a project management app or take part in an online discussion board via email.
When a user asks Mailgun to parse their incoming emails and POST to their app via HTTP, we parse quotations, signatures, and attachments and then post them to a webhook. If a message doesn’t have an HTML part (e.g. it was sent as plain text only) we still try to build an html part from the provided text part and post it as a stripped-html parameter (we also create the stripped-text part when an HTML-only email is received).
Recently a bug was found for this particular use case if the text part included non-ASCII characters. When this happened, they were corrupted in the stripped-html, so for example, “日本語” was transformed into “日本語”. Now the bug is fixed and Mailgun properly creates proper html from text, even with non-ASCII characters.
This seems like a good a time as any to go over what Routes enable because they are really powerful. Routes allow you to set up a series of rules on how to handle incoming messages. Specifically:
Which messages to act on (e.g. messages from a particular person or with a particular subject or even all messages)
What you want to do with those messages (e.g. forward it to another email address or POST it to your app)
When you elect to post the message to your app, Mailgun will either send you the entire unparsed MIME message (if that’s your thing) or parse it for you and POST the parsed parameters. In both cases, we’ll transcode the message to UTF-8 because we love our customers.
Below is a list of the parsed parameters that we will POST to your app when using Routes.
You’ll need to set up your app to receive the parsed parameters. Here is a little flask app that shows you the basics so if you aren’t already, you can start using Routes to handle incoming messages!
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/mailgun-tracking', methods=['GET', 'POST'])
def tracking():
# access some of the email parsed values:
request.form['recipient']
request.form['from']
request.form['subject']
# extended parameters
request.form['Message-Id']
request.form['message-headers']
request.form['timestamp']
request.form['body-plain']
request.form['stripped-html']
request.form['stripped-text']
request.form['stripped-signature']
return "Ok"
if __name__ == '__main__':
app.run(host='50.56.174.200', port=100, debug=True)
If you’re a long time Mailgun reader, you’ll notice that we have a new blog. Some of the new things we think you’ll like are:
It’s responsive so you can read it easily on any device
You can subscribe now to get updates when a new blog is posted (and absolutely no other emails you don’t want)
Each post has related docs so if you read a post about a customer using Mailgun Routes to do something cool, you’ll be able to find the docs most closely related to that topic directly from the post.
We hope you like the new blog. Let us know what you think.
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 August 28, 2020
Continuing Our Commitment: HTTPS Innovation And Optimization
Easier and Faster Implementation with Our Updated SDKs
The Benefits of Email Automation
Mailgun Just Got Better For Client Management
Understanding DKIM: How It Works and Why It's Necessary
Preparing Your Email Infrastructure Correctly
COVID-19 Email Communications Dos and Don’ts
What is Transactional Email? The Basics
Inbox Placement - Delivery Made Simple
Mailgun Is Now Part Of GitHub’s Student Developer Pack
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.