This sponsored post features a product relevant to our readers while meeting our editorial guidelines for being objective and educational.
Why Developers Should Explore Mailgun
If you're not yet familiar with Mailgun, it's the email automation engine trusted by over 10,000 website and application developers for sending, receiving and tracking emails. By taking advantage of Mailgun's powerful email APIs, developers can spend more time building awesome websites and less time fighting with email servers.
What Features Does Mailgun Offer?
- Sending Email (via API or SMTP)
- Inbound Routing
- Tracking and Analytics
- Spam Filtering
- Mailing Lists
- Email Validation
- Managed Email Services
Mailgun's API supports all of the most popular languages including PHP, Ruby, Go, Python, C# and Java, and they offer excellent, well-organized documentation.
There's also an excellent Mailgun plugin for WordPress which helps you link your website to your Mailgun service.
How Much Does Mailgun Cost?
Mailgun is accessible to developers testing and running production environments. The basic account is free for up to 10,000 messages monthly. Mailgun is integrated into Rackspace Cloud, Heroku and Google App Engine.
Overall, pricing is a usage-based, monthly subscription, e.g. 100,000 emails is only $45 per month. Usage is based on outbound messages and the number of dedicated IP addresses used. There is no charge for inbound messages.
You can estimate your costs using the Mailgun pricing calculator:
What This Tutorial Covers
In this tutorial, I'll give you a high-level walkthrough of Mailgun and its key services so you can discover the benefits that it can offer your company, startup or individual projects.
While this is a sponsored piece, I've been a genuinely enthusiastic Mailgun developer for several years. I've written Mailgun-centered blog posts for the company and Envato Tuts+ and added the list subscription functionality to their WordPress plugin last year.
I'm especially interested in your experience with Mailgun or if you want to suggest topics related to email for future tutorials. Please post them below in the comments and of course, you can reach me on Twitter @reifman.
Exploring Mailgun's Features
Quick and Easy Signup
It's simple to get started with Mailgun. To explore Mailgun as you read along with us, sign up here:
You'll be provided API keys and asked to authenticate ownership of your domain(s) with DNS updates.
These make it easy to get started sending private-label emails powered by Mailgun.
Managed Email Services
While many people use Mailgun directly as developers, Mailgun also offers a turnkey managed email service for companies interested in having the difficult aspects taken care of for them.
Sending tens of millions or hundreds of millions of emails a month requires an extra level of diligence to maintain a positive sending reputation. A single misstep can send a big part of your email to spam. Mailgun's managed email service keeps your company's reputation intact—in turn, this ensures that most all of your customers are receiving your emails.
Real-time charting and reporting provide you a view of your email activities:
Mailgun's managed email services help with all of the following needs:
- Deliverability and recipient engagement management
- IP allocation management
- Managed IP warmup
- Reputation monitoring and consulting
- Sending infrastructure consulting
- Email tracking and testing consulting
- Custom reverse DNS on all your IPs
- Dedicated IP subnets with bursting to high quality shared IPs
Sending High Volume Email
Many Mailgun customers use its APIs to automate their email needs. Mailgun offers a high-performing automated email engine with first-class reliability.
When you log in to the Mailgun control panel, you'll be greeted with a chart of recent activity for all of your domains:
Using the Mailgun API
When you use the Mailgun API, you'll have full control over every aspect of your emails.
Recipient variables allow you to easily personalize all your emails for each user. First name, order value, and other common fields are easy. And you can personalize the entire look of the email by including image URLs with your recipient variables.
You don’t have to come to Mailgun to find out what’s happening to your email. They find you. Using webhooks, you can receive real-time notifications for everything that is going on with your email.
As your recipients interact with their email, their activities trigger webhooks, which Mailgun can then use to notify your app directly:
Here's a Mailgun hangout that talks about Webhooks in more detail:
Mailgun's extensive logs help you track and debug any issues that might come up:
You can also use Mailgun as an SMTP delivery engine. While the Mailgun API offers better long-term performance and maintenance, SMTP is an open and established protocol with a large ecosystem that will work with many established systems and applications.
For example, many WordPress publishers lack outbound email services on their hosting plans and struggle to set up basic contact forms for their website. The free Mailgun Plugin for WordPress solves this problem by powering outbound WordPress email with Mailgun's SMTP interface. It's also more secure than operating your own SMTP service, which is filled with risks.
Installing the Mailgun for WordPress plugin is easy:
Once installed, you can also use widgets or shortcodes to collect subscriber emails for your website. It also can support gathering subscriptions to multiple lists.
HTML Email Templates
Sending emails programmatically requires extensive expertise in building HTML templates with compatibility across clients and email services. It's time-consuming. Mailgun's begun offering a small suite of pre-built, tested email templates which they share with you. Here's an example invoice:
Here are links to the existing HTML templates which you can reuse or build on for your application:
Mailgun's tested these on a variety of email clients and services:
The templates are downloadable from their open-source GitHub account.
Excellent Developer and API Documentation
As a developer, Mailgun has top-notch documentation. It provides support for a variety of languages, e.g. Ruby, Python, PHP, Java, C# and Go. It provides working examples of implementing Mailgun functionality across its services, whether you're broadcasting, tracking or routing.
You can configure Mailgun to receive all your inbound mail, process it and route it to other email addresses or web applications. The front-end user interface for configuring routing is friendly and easy to use:
Essentially, Mailgun takes unstructured inbound email (shown at left) and sends your application parsed, structured data (shown at right):
Developers spend months coding email parsing on their own, a task that's never really complete. Mailgun manages this for you.
Mailgun's routing features also provide the following capabilities:
- Optionally receive raw MIME message
- All messages encoded to UTF-8 automatically
- Free spam filtering
- Easy testing of webhook endpoints
- Text-part generation from HTML-only emails
- Matching on all email headers (e.g. subject, from:, cc:) and recipients
- Ability to chain together multiple filters to provide sophisticated expressions
Campaign Tracking and Analytics
Mailgun supports campaign-ids in your email and can track performance of any of your broadcast efforts by these ids.
Furthermore, regular analytics are provided through the web interface or through the Stats API:
You can also segment your emails using tags. With tags, you can create simple A/B tests or do deeper cohort analysis.
If you also use webhooks, your tags are automatically encoded into the webhook, which makes tying email back to your data a breeze.
With tags and webhooks, it becomes straightforward to gain the following analytical functionality:
- Unsubscribe tracking
- Open & Click tracking
- Geolocation data on recipients
- Email client and device tracking
- Top performing links
Here are a few of Mailgun's client case studies showing its powerful tracking and analytics features at work:
- Closing the loop between your customer data and your email data
- How Tealeaf Academy increased student engagement 3x
- Building a data-driven approach to keeping user’s emails up-to-date
- How kanban2go fulfills Zawinski’s Law
As you use Mailgun to process your inbound mail, you can ask it to apply various levels of spam filtering:
This can greatly reduce the processing load of your own application on the remaining, valid email.
Mailgun also offers mailing lists which you can use for various purposes or campaigns. You can set them up through the control panel user interface or the Mailing List API:
It's easy to create lists through the control panel:
You may also want to check out my Mailgun blog post about a third-party PHP-based application which uses various features of the mailing list API: Open-source mailing list applet using the Mailgun PHP SDK.
While RFC email standards state formal rules for email addresses, in the real world email service providers accept addresses that are not RFC-valid, and reject addresses that are.
Mailgun built its own email validator based on real-world data and the RFC specification to ensure more accurate validation. They provide access to the validator through its open-source JQuery Email Validator plugin.
You can try out Mailgun's email validation on its website and then integrate it into your application anywhere:
The Mailgun Plugin for WordPress
The Mailgun WordPress plugin enhancements that my company, Lookahead Consulting, built last year is the connection to the Mailing List services. The plugin makes it easy to gather WordPress subscribers into your Mailgun account:
Mailgun offers a vast array of email services that are relevant to all kinds of coding, marketing and business development needs. And, impressively, they do a great job at all that they offer. Certainly this is a sponsored post, but as an experienced user, I offer my authentic recommendation for you to try out the service today. I hope you're excited to do so.
Please let me know which Mailgun features you'd like to see more written about in the future. You can post them in the comments below or reach me directly on Twitter @reifman.
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post