Send Mail In WordPress With Mailgun Service & Plugin


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!

« Previous Post
Next Post »

6 COMMENTS ON THIS POST To “Send Mail In WordPress With Mailgun Service & Plugin”

  1. ThemeVan December 2, 2015 at 6:40 am

    If you have any questions, please let me know in this comment section.

  2. Rajkumar Kanagaraj May 24, 2016 at 9:04 am

    thanks for the post and info about mailgun. will look up on it

  3. rea June 25, 2016 at 12:37 pm

    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 … ????

    • John Wu July 1, 2016 at 5:11 pm

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

  4. Greg-J July 27, 2016 at 10:45 pm

    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?

    • John Wu July 28, 2016 at 3:21 pm

      Hi, I’m not sure how is your settings, so I find MailGun’s support page to you, you can submit a ticket to their support.


Leave a Reply



We are addicted to WordPress development and provide Easy to using & Shine Looking themes selling on ThemeForest.

You can also follow us on the following social network.

Error: Please enter a valid email address

Error: Invalid email