Grow Your Subscribers With the Mailgun WordPress Plugin
The Mailgun Plugin’s New List Subscription Feature
The Mailgun WordPress plugin has always been a simple way to add outbound email support to your WordPress server simply, easily and affordably—without the hassle or risks of running your own SMTP service. Now, they’ve added support for Mailgun List subscription to your WordPress posts, pages and widgets.
One particularly useful feature of this plugin is that it provides you with a way to send email when the server you are on does not support SMTP or where outbound SMTP is restricted, since the plug-in uses the Mailgun HTTP API for sending email by default. All you need to use the plugin is a Mailgun account. Mailgun has a free account that lets you send up to 200 emails per day, which is great for testing. Paid subscriptions are available for increased capacity.
The latest version of this plugin adds support for Mailgun list subscription. Using the shortcode, you can place a form on an article or page to allow the visitor to subscribe to one or more lists. Using the widget, you can provide subscription functionality in sidebars or anywhere widgets are supported, e.g. footers.
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. I’ve been a regular user and advocate of Mailgun for a few years now.
Mailgun has fantastic developer documentation and supports all of the most popular languages including PHP, Ruby, Python, C# and Java. And it offers a free account that lets you send up to 200 emails per day, which is great for testing. Paid subscriptions are available for increased limits.
In this tutorial, I’ll walk you through installing the plugin on your WordPress site, creating a list in the Mailgun control panel and then adding subscription forms to your site via widgets and shortcodes.
In addition to this post being sponsored by Mailgun, my firm, Lookahead Consulting, led the list subscription updates to this plugin working with my colleagues at M35 Development, so I’m personally excited to share it all with Envato Tuts+ readers.
Before we get started, if you’d like to share more of your experience with Mailgun and its WordPress plugin, please add your comments below. You can also reach me on Twitter @reifman directly.
Installing the Mailgun Plugin
There are several ways to install a plugin with WordPress. You can search for it and install it directly, or download it to your desktop and then upload it to your website.
To begin, visit your Plugins listing from the WordPress Dashboard menu:
Click Add New and search for mailgun:
You can click Install Now or you can upload the file from your browser like this:
Once you’ve completed the installation, it’s time to Activate the Plugin:
Once it’s installed, you’ll be returned to your WordPress Dashboard Plugins listing:
Now, let’s configure the plugin to access your account and its lists.
Configuring Your Mailgun Plugin Settings
From the plugin list above, click Settings:
You can see the remainder of the Settings page below:
Enter your domain name and API key as I’ve done above from the Mailgun Control Panel shown below:
Once you’ve saved those settings, click the Test Configuration button above in the WordPress settings panel. You should see a popup like this below and receive a confirmation email shortly after:
Your Mailgun Lists
Just as a reminder, let’s peek again at the Mailgun Control Panel Mailing Lists:
If you don’t have one, click Create Mailing List and fill in the form below to save it:
Return to your Mailgun plugin settings page within the WordPress Dashboard. Click View available lists:
Above, you can see my Mailgun lists from within WordPress. Next, let’s add the subscription widget to our sidebar.
Adding a Subscription Widget
Visit the Appearance > Widgets page and drag the Mailgun List Widget to your Sidebar:
Configure the settings with an optional widget title and description. If you wish, you can check the box to collect the full name as well as the subscriber’s email address. Enter at least one Mailgun list address, e.g. email@example.com.
When you view your WordPress site, you’ll see something like this. Observe the right sidebar with the widget:
When users click Subscribe, they’ll see a thank you notice.
If you provide a comma separated list of Mailgun list addresses, you can give the user an option to subscribe to multiple lists. I’ll show you an example below with the plugin’s shortcode support.
Using the Subscription Shortcode
Now, let’s add list subscription forms to our content, articles or pages. In this example, I’m going to edit my About Page and add the following shortcode:
If you'd like to subscribe to one of our newsletters, please provide your email address below and select the list(s) you want to be on: [mailgun id="firstname.lastname@example.org,email@example.com,firstname.lastname@example.org"]
Here’s what the subscription form will look like on my About Page with multiple lists—see the lower left of the body of the page:
And that’s it. Pretty simple, huh?
I hope you’ve enjoyed our visual guide to the new plugin features. Please let us know which features you’d like to see added to the plugin next. You can post them in the comments below or send us an email.
If you’d like to learn more about Mailgun Lists and programming them, check out Open-source mailing list applet using the Mailgun PHP SDK.
Please share your thoughts with us about Mailgun and the new plugin in the comments below. You can also reach me directly on Twitter @reifman. And, be sure to browse my Envato Tuts+ instructor page to see some of my other tutorials.