Mailgun is an email automation service. It offers a complete cloud-based email service for sending, receiving and tracking email sent through your websites and applications.
With Mailgun, you can solve WordPress site delivery issues. To start using Mailgun service, you'll have to configure your DNS based on your Mailgun settings.
How to configure the DNS based on your Mailgun settings
Email you want to integrate: [email protected]
To integrate Mailgun with your WordPress site, please follow these steps:
Step 1: Open Mailgun account
- Signup for Mailgun here
- Login to your Mailgun account
Step 2: Add your domain
- Add a new domain mgtest.yourdomain.com. What the Mailgun is asking for here is your subdomain ("mgtest") that your WordPress mail is going to be handled on.
Step 3: Verify your domain
Go to your domain manager to add a few DNS records
Just a brief review: "A" records is your main website, "MX" records are your main webmail, and there are a few different other things like NS (name server).
Add DNS records for emails sending
The first thing you are going to do is to add two TXT records.
Note: When adding hostname, you don't need the entire hostname, you just need a sobdomain that you're going to be using: mgtest.
- Add DNS record:
- select type "TXT"
- enter the host mgtest
- add value from the Mailgun
- click on "Save"
- Add the next one record (mailo._domainkey.mgtest) and value. Click "Save".
- Add MX records (if you do not have MX records for mgtest already, add the mail server for mgtest). Go to your DNS manager and add the record:
- select type "MX"
- add host mgtest
- for "Points to" add mxa.mailgun.org
- priority 10
- Click on "Save".
- Do the exact same thing for the next MX record: mxb.mailgun.org
Add DNS records for tracking (optional)
You may need to add a CNAME record to your domain's DNS records. This is for emails tracking opens, clicks, and unsubscribes. You can track emails with your own custom tracking domain to improve email deliverability.
Note: Set this if you you're going to be doing maillist.
- Go to your DNS manager and add the record:
- select type "CNAME"
- add the host email.mgtest
- enter the value from Mailgun
- click "Save"
Step 4 : Check the DNS records
To check if the DNS records are configured properly,
- go to Mailgun and click on "Check DNS records now"
Note: It may take some time for configurations to take effect.
Step 5: WordPress Mailgun settings
After your DNS configuring, follow these steps:
- Go to your WordPress site, add the Mailgun plugin (Mailgun for WordPress), and activate.
- Open the plugin settings and
- for "Mailgun Domain Name" enter mgtest.yourdomain.com
- enter your Mailgun API Key
- "From Address" add [email protected]
- save and test configuration
Step 6: Test email integration
Send one email to [email protected] for testing.
To see if it works, go to Mailgun => Logs and check the email status (delivered, rejected, accepted). Here you can see if an email is delivered to your Gmail: [email protected]
When you integrate Mailgun with your WordPress site, you will improve your email reliability and can ensure that all emails get delivered on time and securely.