In this article, I'm going to show you how to integrate Mailgun in your automation platform.
To complete this process, you'll need two things - an existing Mailgun account and a platform agency account. If you haven’t created a Mailgun account yet, please do so before continuing this tutorial.
To start, log in to Mailgun. When you open your account, it will take you to your Dashboard.
Click Sending on the left menu, and then click Domains.
This will open your domains page. Click Add New Domain in the top right.
While configuring your domain, it's highly recommended to use a subdomain, such as replies.yourdomain.com or response.yourdomain.com. Enter your complete domain (including the subdomain) in the field provided.
After you've entered your subdomain, click Add Domain at the bottom.
For this demo, we're going to use “response” as our subdomain.
Your domain has been added, so now you’ll need to configure your DNS.
If you scroll down, you can see the DNS records you’ll need to add.
In a new browser tab, open your DNS provider's site and log in. We'll use GoDaddy for this demo, but most DNS companies will have a very similar setup.
Then, navigate to your domains list, and then click DNS on the domain you added into Mailgun.
This opens a DNS management page. Click Add at the bottom to insert a new DNS record.
The first addition we need to make is a TXT record. When you select TXT from the dropdown, more fields will appear.
We can leave the TTL field at its default value, but we'll need to enter information for the Host and TXT Value. These can be copied and pasted from your Mailgun tab.
For the host field, copy and paste the subdomain only (not the full domain).
For the TXT Value field, copy and paste the string under Enter This Value.
When both values have been entered, click Save.
The next record we’ll need to add is also a TXT record. For this one, you’ll click Add and select TXT again, but the Hostname will be different.
Instead of only the subdomain, copy and paste all the information before the domain name.
Then copy and paste the TXT Value as before.
And click Save to create the record.
Now, you’ll need to add two more records, but this time they are MX records.
Click Add again, and select MX from the dropdown.
Then copy and paste the subdomain for your host field and the text presented for your Points To field (Enter This Value).
You can leave the Priority Value at its default setting of 10 and the TTL Value at 1 hour.
Then click Save to create the record, and perform the same process for the second MX record.
Here you can see that we've added both of our MX records from Mailgun.
But there's still one more record to add. Click Add.
Select CNAME from the dropdown.
And as before, we'll need to grab values for these 2 fields from Mailgun.
Copy and paste the hostname without the domain and then the entire value for the Points To field (Enter This Value).
Once all fields are entered, click Save.
Great! We've created all 5 of our DNS records, so we're done with this part of the process.
Now let's switch back to Mailgun to verify that our setup is correct.
At the bottom of your Mailgun domain settings page, click Verify DNS Settings.
This will test each of the 5 records that we just created and you'll notice a green checkmark if they're working properly.
The next thing we'll need to do is integrate Mailgun into your platform.
Click Dashboard on the left menu.
Then click your name icon in the upper right.
In the dropdown that appears, select API Keys.
This will open up a page with three keys. The only one we'll need is the Private API key.
Click the eye icon to the right to view the entire key and then copy the Private API key.
Now, switch back to your platform and click Settings on the left menu. Then, click Mailgun on the new left menu that appears.
Click the pencil icon next to the Mailgun logo.
This will open a pop-up where you can paste your Mailgun Private API key in the appropriate field.
The sub-domain will be automatically filled.
Now your Private API key and the attached subdomain will show up on your platform's Mailgun settings, confirming that the integration has been successful.
Lastly, add the API to your desired location by clicking the pencil icon and then copy and paste the API key.
Here you can see that we've added our Mailgun API to our location, meaning that the integration is fully operational and can now be used.