Send Mail In WordPress With Mailgun Service & Plugin

Tips & Tricks, WordPress


Recently I received many questions from our theme users that their WordPress website can’t send mail to visitors. Generally, I told them to make sure the PHP sendmail module is working properly on their server, however, after they installed the sendmail module and checked again, they had another problem that the sending speed is very slow and asked me how to fix it, it’s a server configuration issue, although I know a solution is that update the “/etc/hosts” file on your server with “nano /etc/hosts” command to like this: localhost.localdomain localhost yourhostname, but I just strongly recommend to use Mailgun SMTP service to instead of PHP sendmail, because of high stability.

Sign Up With Mailgun Service

Mailgun provides a powerful and easily use service, the free plan is awesome but you can only send 10000 emails in a month, even so, it’s enough for the personal and small business, and you can upgrade to the other plan at any time. Well, let’s go.

Visit Mailgun website, click the sign up button and complete your account details.

Sign Up with Mailgun

OK, click Create Account button, then go to your email and check the activation link to verify your account.

When you go to “domains” page, you will see the sandbox that you can use it directly without add new domain. mailgun sandbox

Click the sanboxb966350a…. link to see the test domain details like below

mailgun domain information

Don’t close this page, and go to your WordPress Dashboard now.


Install Mailgun Plugin

Login your WordPress Dashboard and go to “Plugins > Add New”, search “mailgun”, find the “Mailgun for WordPress” plugin by Mailgun like below, install and activate it.

mailgun plugin install

Now let’s go to “Setting > Mailgun” page, just copy the domain and api values from the domain information page, complete the fields as below.Mailgun Settings

That’s it! After you save changes, you can click test configuration button, it will send a test mail to the WordPress administrator email.

Add Own Domain (Optional)

Back to your Mailgun domains page, click “Add New Domain” button, enter your own domain

mailgun: add domain

Mailgun: DNS
Click it to view the large picture


For example, if your domain name was registered at godaddy, then go to your godaddy account to manage your domain DNS records. After you finished it, back to this page and click “continue” button, it will lead you to the final page as below.

mailgun verify


After a while, you could click “Check DNS Record now” button to know whether the new DNS records are valid or not. When they are valid, your own domain will actived, just enjoy it!

6 thoughts on “Send Mail In WordPress With Mailgun Service & Plugin

  1. I did all this, I can see my list, but I still do not know how and where to compose an email??
    Do I need another plug in to compose email? Just every documentation stops here, right before the vital point. I did all these steps on my own, but now how can I send email? Where to compose, where to schedule … ????

    1. Actually, Mailgun is only a email server(SMTP) for the automatic email sending, not a email service.

  2. Followed the instructions and I get “Mailgun HTTP API Test Failure”.

    Switched to SMTP options and I get “Mailgun Secure SMTP Test Failure”.

    This is using the sandbox account. I’ve double and triple checked the fields to make sure the information is entered correctly.

    Any ideas?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.