Getting Your MailGun API Keys and Secrets Setup

Anthony Comito
Sep 28, 2016 · 4 min read

One of the most common features we need to support in our applications is the ability to send email. We need an easy way to communicate with users about things like account creation, password resets, and activity in our application. Whatever the use case, email is a must have. But you don’t want to handle this all by yourself. Luckily there are many free-to-start email services like MailGun.

To use mailgun in your application you will need to create a mailgun account and get an API key. This API key is a way for mailgun to verify that the app trying to talk to mailgun servers is truly your application, and not an imposter.

An API Key is your applications MailGun Drivers License. Getting the API is kind of pain (but not as bad as going to the DMV). See the below post to get started:

Getting Started with MailGun

Go to MailGun.com and click the signup button in the top-right corner:

Fill in the signup form and click “Create Account”:

The next page may look a little confusing but just scroll down to the bottom and click “Continue to Your Control Panel”:

(you may need to verify your email, or verify your account with an phone text message code)

But once you get into your MailGun account, you should see a page like the below:

Click “Domains” from the top navigation (to the left on the top navigation):

You should see a page like the below (my domains are omitted with black lines):

Click “Add New Domain” in the top-ish left side (highlighted green):

Fill in the “Domain Name” input field with the following:

mail + .YourWebsiteName.com

So if my website domain is www.YourWebsiteName.com, I will put:

mail.YourWebsiteName.com

You will still be able to send emails from your normal domain like:

support@YourWebsiteName.com

Once you click “Add Domain” you should land on this page:

At this point, you are almost done! You don’t have to do anything with this page now. You can get help from your developer. Next thing to do is to click the “Domains” tab again at the top of the page:

You will see your new domain in the list now:

Click on your domain to get to this page:

You want to get the Default Password, API Base URL, and API Key and send those to your developer.

**MAKE SURE YOU KEEP THESE PRIVATE.

You don’t want these getting loose on the internetz or the google.

You can find them here:

That is it! You’ve (almost) setup your mailgun account. You’ll need to also verify your domain name. But that is another story. Ask your developer.

FURTHER READING:

1. Verifying the Domain

Essentially, you need to go into the account where you bought your domain name (GoDaddy, Namecheap, etc.) and input some numbers that mailgun will give you. Then mail gun will ask your domain name for those numbers, and if mailgun gets the correct numbers back, then mailgun will know that you do indeed own the domain/URL and had access to go in and add the verifications numbers mailgun gave you.

If you want to give it a try yourself, here is a quick walk through of the process:

2. Giving Your Developer Access:

You can also give your developer access to mailgun:

3. Custom Email Domain with Gmail and GoDaddy:

Anthony Comito

Written by

I help build startups at FOUNDRY41 and help grow economies at GrowLab.io

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade