If you're running a WordPress blog nowadays, chances are you plan to build an email list or you might already have one. More than often, collected email addresses are used for email outreach, but what happens if WordPress can't successfully send email to your subscribers?
That's where Mailgun comes in. Mailgun is then the perfect solution that helps you to send emails successfully to your subscribers. Before seeing how to use it on WordPress, let's first understand what is Mailgun.
What is Mailgun and how does that work?
Mailgun is an email automation service designed and provided by Rackspace. This service offers a cloud-based email service for sending, receiving and tracking email sent through your websites and applications (including WordPress).
Most of Mailgun features are available through an intuitive RESTful API or via traditional email protocols like SMTP, POP3, IMAP. This means it won't use PHP internal mail functions, which is pretty useful if you're using shared hosting with restricted email service or if you're using WordPress locally (or any PHP application to send email).
Create Amazing Websites
With the best free page builder ElementorStart Now
The good news here is that it's a service available with a continuous trial offer. By continuous, we mean that it doesn't expire over time, but you're limited by the number of emails that can be sent. For example, you can send up to 5000 emails monthly (that's fairly enough for new blogs), use accurate reports, etc. If you need more, you'll need to upgrade.
Upgrading will give you a lot of benefits, such as a dedicated IP address, which will be useful over time as some email sends by Mailgun doesn't always reach Hotmail (Microsoft email service). The reason is that Mailgun uses the same IP for the Free Plan, this has led the IP to be banned from some services as it's often referenced on the spams list. However, this shouldn't be a huge concern for you, since for other services it works well.
Let's now see how to use it on WordPress.
How to setup Mailgun on WordPress (in 2 steps)
We'll divide this tutorial into 2 different sections. The first section will be made on the Mailgun and your registrar website and the second on your WordPress blog.
1 - Creating & Using Mailgun Account
The first step before sending an email from WordPress is to make sure to have created an account on Mailgun. This should be a pretty simple step, as you'll just be asked to provide basic information such as email, username & password, payment fields, etc.
Make sure, to uncheck "Add Payment info now", if you don't want to provide your payment information. After the registration, you'll certainly go over the validation process, which consists of activating your account using your email and your phone number. Once activated and connected, you'll land on a similar dashboard.
This dashboard shows the current activity of one of our WordPress website. It has some interesting metrics such as total email sent, total bounces, and total deletion (things you can't get with PHP mail function).
To proceed with the integration with WordPress, we'll head to "Sending > Domains". From there, you'll see an Add Domain button. You should note, if you don't see that domain, then probably you haven't successfully activated your account.
On the next page, you'll define your domain settings. Typically, it's suggested to use a subdomain for sending emails (useful for troubleshooting). For example, if you have a johndoe.com as your main domain, you can use notifications.johndoe.com or mail.johndoe.com.
The other fields have working default values, you can proceed with. The next step is to define the DNS settings. This is actually a required step, to make Mailgun works. Configuring the DNS will consist of adding MX, TXT, and CNAME records on your registrar DNS configurations.
We're using Cloudflare for managing our domains. The step might be different if you're using another Registrar but, at the end that remains the same steps to go through.
You'll first need to reach the domain of your choice.
Then on the top menu, you'll see the DNS section. You need to click on that to reach your DNS settings.
You'll then just need to fill up your configuration. You should note that Mailgun has various configurations that enable different features. For example, some TXT records will enable sending records, other receiving, and tracking records.
Once you're done, you should wait around 24-48 hours to see the changes applied. We're not done with the first steps of this tutorial. Let's find out to configure it on WordPress.
2 - Configuring Mailgun WordPress Plugin
Fortunately for us, Mailgun has created a WordPress plugin that eases the integration with WordPress. The first thing to do now is to install the plugin that is available on WordPress.org. While it's mentioned that the plugin hasn't been updated for 3 years, till now it does the job very well.
You can also install the plugin directly from your WordPress dashboard. By searching the term "Mailgun for WordPress" on the search bar.
Once the plugin is installed and enabled, a new settings submenu named "Mailgun" will be added under the "Settings" menu.
By clicking on that menu, that will lead you to the configuration page, where you'll need to create a match with your actual Mailgun details. For instance, you'll need to provide :
- From Address
- From Name
- Api Key on Mailgun Settings
- Mailgun Domain
When you've retrieved these details from Mailgun, don't forget to save your changes on WordPress. From now, Mailgun will be in charge of your emails.
While using WordPress, you'll often have to send emails to your subscribers. If, by default, the PHP functions provided can do the job, more than often it won't be a nice solution for enterprises willing to have tracking tools for their emails. Mailgun is therefore a nice solution that comes with a free plan suitable for new blogs.
Throughout this tutorial, we've noticed that the configuration can be made in 2 different steps :
- Creating a Mailgun account and setting up DNS details
- Installing and Configuring the Mailgun WordPress Plugin
Let us know if that has been helpful for you in the comments. If there is another tips that you would like to share with us, don't hesitate.