How to Set Up Mailgun for WordPress Emails [3 Easy Steps]

Do you know that if you set up Mailgun for WordPress emails, the email deliverability of your WordPress website can improve significantly?

Setup Mailgun for WordPress

You may be wondering why WordPress isn’t sending transactional emails properly so they can hit the inbox instead of spam. The short answer to this is the default wp_mail() function. We’ll cover it in more detail later.

In today’s guide, we will walk you through the step-by-step process of how to set up Mailgun for WordPress emails. We will also answer some basic questions, such as What Mailgun is, why you need Mailgun to Send WordPress emails, and what the requirements are to configure in the first place, etc.

So, without further ado! Let’s dive right in!

What is Mailgun SMTP Email Service?

Mailgun is an email service provider specializing in sending, receiving, and tracking emails. The service is ideal for developers who need a flexible and scalable solution for sending emails directly from their applications, for example, a WordPress website or a mobile app.

Email service provider

Mailgun offers a RESTful API that allows you to send emails using HTTP requests, as well as an SMTP relay service that lets you use any email client or library to send emails through Mailgun’s servers.

You can use the service to send both transactional and marketing emails, such as password resets, order confirmations, newsletters, promotions, etc. Additionally, you can send emails from multiple domains and subdomains, which means you can send emails from different addresses using the same account.

Why Is It Better to Use Mailgun SMTP Email Service for WordPress Emails?

By default, WordPress uses the PHP mail() function to send emails from your website. However, this method has several drawbacks that can affect your email deliverability and performance. Some of the common problems with using PHP mail() are:

  • Lack of Email Authentication: It doesn’t authenticate your emails, which means they can be easily marked as spam or rejected by email providers.
  • Absence of Feedback: You don’t get any information about error handling, which means you cannot know if your emails are delivered.
  • Limited Support for Advanced Features: By default, the WordPress PHP mail() function does not support advanced features such as HTML formatting, attachments, headers, etc.
  • Dependency on Web Server Configuration: It relies on your web server’s configuration and resources, which can vary depending on your hosting provider and plan.

To overcome these limitations, using an external email service provider like Mailgun to send WordPress emails is better. By using Mailgun SMTP email service, you can benefit from the following advantages:

  • Strong Email Authentication: It authenticates your emails using SPF, DKIM, and DMARC records, which improves your sender’s reputation and deliverability.
  • Comprehensive Feedback and Analytics: You can view detailed logs and analytics for your emails, which helps you monitor your email performance and troubleshoot any issues.
  • Robust Email Feature Support: It supports all the features you need to create professional and engaging emails, such as HTML formatting, attachments, headers, templates, etc.
  • Reliable Dedicated Infrastructure: With dedicated servers and infrastructure optimized for email delivery, you can make sure that your email delivery is reliable and fast.

NOTE: To set up Mailgun SMTP email service to send WordPress emails, you need to use a reliable WordPress SMTP Plugin, such as Post SMTP, which makes the whole SMTP configuration process a breeze! 

Requirements for Configuring Mailgun to Send WordPress Emails

Before you can set up Mailgun for WordPress emails, you need to have the following requirements ready:

  • Admin access to the WordPress website where you want to configure the Mailgun SMTP server
  • A Mailgun account with a paid subscription, as with a free account, you can only send emails from the sandbox domain to five authorized recipients.
  • Your WordPress site must have an SSL(HTTPS) certificate enabled.

3 Easy Steps to Set Up Mailgun for WordPress Emails

Once you have the above requirements ready, you can proceed with the following 3 easy steps to set up Mailgun for WordPress emails:

Step #1: Install and Activate the Post SMTP WordPress Plugin

Installing and activating the Post SMTP WordPress plugin on your website is the first step. This plugin will help you connect your WordPress site to your Mailgun account and configure the SMTP settings for sending emails. To install the plugin, follow these steps:

  • Log in to your WordPress dashboard and go to Plugins → Add New.
  • In the search box, type “Post SMTP” and hit enter.
  • Find the plugin named “Post SMTP Mailer/Email Log,…” by Post SMTP and click on Install Now.
  • After the installation is complete, click on Activate.

Once Post SMTP is activated, you will see the following screen.

Configure the SMTP settings

Step #2: Create a New API Key in Your Mailgun Account

Now log in to your Mailgun account and create a new API key. This key will allow you to authenticate your emails and use the Mailgun API to send emails from your website. Follow the below guidelines to create a new API key:

  • After logging in, click the API Keys option in the bottom right menu.
API keys option
  • Now, click on the Add new key button.
Add new key button
  • Enter a name for your API key (e.g., “Post SMTP Mailgun”) and click on Create API Key. Don’t forget to copy the API key and paste it on a Sticky note or Notepad for later use.
Enter a name for your API key
  • After copying and securing the API key, go to Sending → Domains and copy the default sandbox domain. Remember, we are using a free Mailgun account here. If you have a paid account, you can create a custom domain.
Default sandbox domain

IMPORTANT: We will use the API key and Domain address you copied earlier in the following steps while configuring Mailgun for WordPress using Post SMTP. 

Step #3: Add Your Mailgun Account Details in Post SMTP Setup Wizard

In the final step, we will walk you through the Post SMTP setup wizard to set up Mailgun for WordPress emails. To do so, follow the instructions below:

  • First, get back to your WordPress dashboard, click on Post SMTP from the left-hand side menu, and click Start the Wizard. Provide the Name and Email Address that will appear in your outgoing emails. Now, hit the Next button on the bottom left of the screen.
Click start the wizard
  • As you want to configure Mailgun, you can ignore the “Outgoing mail server Hostname” and click Next. Wait a moment, then select Mailgun as your SMTP email server and press Next
Mailgun as your SMTP email server
  • Enter the API Key and Domain Name you’ve copied on a Notepad or Sticky note in step#2 and press Next.
Enter the API key and domain name
  • On the subsequent screen, you’ll see the “You’re Done!” message. Simply hit the Finish button at the bottom left of the screen.
Simply hit the Finish button

Congratulations! You’ve now successfully set up Mailgun for WordPress Emails. To verify the Mailgun WordPress configuration, simply send a test email.

Don’t Forget to Test WordPress Email Deliverability

Remember that we’ve signed up for a free Mailgun account, so don’t forget to authorize the recipient email before sending a test email.

To do so, go to the Sending →Overview and then type the recipient email in the Email Address field on the left menu of the screen. Once your receipt has been verified, you can send a test email.

Recipient email in the email Address field

To send a test email, click the “Send a Test Email” button, as shown in the image below.

Send a test email button

Provide the email address in the Recipient Email Address field and hit the Next button.

Recipient email Address field

On a successful email delivery, you’ll see a green Success status on the next screen, as shown in the image below.

Success status on the next screen

Finally, press the Finish button, and you are ready to send WordPress transactional emails.

IMPORTANT NOTE: With Post SMTP, you can connect to any SMTP server, including all major SMTP service providers such as Gmail, Microsoft Office 365, Amazon SES, Brevo (formerly Sendinblue), SendGrid, PostMark, SparkPost, Mailgun, Elastic Email, Mandrill, etc.

Key Takeaways – Install Post SMTP to Set Up Mailgun for WordPress Emails

Mailgun is a robust and reliable email service provider that can help you send WordPress emails with ease and confidence. By using Mailgun SMTP email service, you can improve your email deliverability and performance. Additionally, with the help of the logs and analytics, you can monitor and track your email campaigns and troubleshoot any issues. 

To set up Mailgun for WordPress emails, install the Post SMTP WordPress plugin, as it supports OAuth 2.0 authentication, so you don’t have to store your Mailgun account credentials on WordPress.

We hope this article helped you learn how to set up Mailgun for WordPress emails in 3 easy steps using the Post SMTP WordPress plugin. If you have any questions or technical difficulties, feel free to contact us for expert assistance with all your WordPress SMTP configurations.

Frequently Asked Questions

How to set up a Mailgun in WordPress?

To set up Mailgun in WordPress, you must have a Mailgun account, a custom domain name, and the Post SMTP WordPress plugin. Install the Post SMTP plugin and follow the Setup Wizard to configure the Mailgun in WordPress.

How can I set up SMTP for WordPress with Mailgun?

You can set up an SMTP server for WordPress with Mailgun using the Post SMTP WordPress plugin. This plugin lets you connect your WordPress site to your Mailgun account and authenticate your emails using an API key. Plugin’s Setup Wizard offers an easy and simple way to connect any SMTP server to your WordPress site. You can even check and monitor your email delivery by sending a test email.

What is Mailgun in WordPress?

Mailgun is an email infrastructure service provider that makes it easy to send WordPress emails. Over 10,000 website and application developers use Mailgun SMTP email service for better sender reputation and faster delivery. Also, With Mailgun’s logs and analytics features, you can track email campaigns and troubleshoot any issues effectively.

Is Mailgun an SMTP server?

Mailgun is an email service provider that offers SMTP relay service to send emails from any email client or library through Mailgun’s SMTP servers. Using Mailgun’s cloud-based SMTP and API service, developers and non-developers can send emails through their websites and applications.

What is the difference between SMTP and Mailgun?

SMTP stands for Simple Mail Transfer Protocol, which is a standard protocol for sending and receiving emails over the Internet. However, most email clients use SMTP to send emails only. On the other hand, Mailgun is an email service provider that uses SMTP as one of its methods for sending emails. Apart from that, Mailgun offers other services as well, such as email validation, email analytics, email templates, webhooks, and more.

Scroll to Top