# How to Connect Mailgun

In other to get started with this, you need to first create an account with Mailgun, you need to add your credit card during sign up as per Mailgun's requirement, plus you will get up to **5,000 free emails** sending capacity for up to **3 months!** You can get started by clicking [here](https://signup.mailgun.com/new/signup).

Then, you would be prompted to verify your Email and Mobile number, after this you can now login and follow these 3 easy steps to complete your SMTP integration:

1. Add your domain name
2. Verify your DNS records
3. Create, copy and integrate Mailgun's API

**Add your domain name**

From the Mailgun's dashboard, click on **Sending** and then **Domains** on the left.

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9HbPIRGtHL0TyfOWk%2Fimage.png?alt=media\&token=475e67d3-5571-46fa-881e-afd20dcadbd4)

Finally click **Add new domain** on the screen that follows.

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9HUFw1XNbiPYEhf_s%2Fimage.png?alt=media\&token=fd8fb3ed-fe07-4fad-b120-a85cb14b3a0f)

Enter a **sub domain and not the main domain** of your website, sub domains are very easy to create and if you are not familiar with this, you can get in touch with your hosting support/domain provider (because the steps are quite different from one host to the other ), ,but your host will assist you with a reference document that will guide you on how to create one for your domain. Sub domains looks like this **"mail.example.com"**, where the main domain is **"example.com".**

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9HOJweGhLvayLbraR%2Fimage.png?alt=media\&token=96b41f92-8698-4a7e-9e02-07f9d06d2604)

Depending on which region your website is hosted, choose **US** if within the US or outside of US but not within Europe or choose **UK** if within Europe and set the **DKIM** like the image below:

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9HG52xyi0fL8KfWQh%2Fimage.png?alt=media\&token=0889c2db-69d3-4a2d-a205-835c45eea491)

**Verify your DNS records**

On the next screen, Mailgun will show you **4 steps** to follow in other to verify your website's DNS record successfully.

The **first step** displays reference guides for some hosting providers on how to easily verify your website's DNS records, you can click the links to learn if your hosting provider is amongst the list, if not, then we recommend **contacting your hosting support for guidance** on how to add and verify these text records to your hosting and don't worry, the process is quite easy.

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9H5hqCj_b_VQ9VKnQ%2Fimage.png?alt=media\&token=cbf6195e-b100-4294-be15-fbd400487085)

The **second step** provides you with 2 **TXT** records that you need for this process, you need to copy and paste them in the appropriate settings area for your hosting.

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9GymtpXvJaVfZd3tp%2Fimage.png?alt=media\&token=e4610412-9fe7-4d61-a67c-eaa6abc67488)

The **third step** is about the **CNAME** record verification, you can ignore this as it is not necessary.

The **fourth step** shows verification button, click on the **Verify DNS Settings** and note that it can take **24-48hrs** for those changes to propagate. Mailgun will email you to let you know once your domain is verified. But this does not stop from you from finishing up the settings, just go ahead and complete this integration.

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9GbLPmPi58XpiqEEu%2Fimage.png?alt=media\&token=4d483e0f-e3c8-4625-a6af-d03bd119b7ba)

**Check the status of your domain verification**

You will get a message from Mailgun once your domain has been successfully verified but you can still check the status anytime by clicking on **Domain** and next to your sub domain, an **Active** status will be shown if it has been verified successfully.

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9GWFWvDH8HgXM_sPi%2Fimage.png?alt=media\&token=28cf98a0-1f82-440f-980f-c8ffe5b9eeea)

**Create, copy and integrate Mailgun's API**

This is the **last process** which is quite easy because we will connect Mailgun by using the available API and a direct link to this API page is available next to the API's field or just [click here](https://app.mailgun.com/app/account/security/api_keys) to visit the page. Click the eye icon to reveal the key.

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9GMI6y48UeJ-fj-6t%2Fimage.png?alt=media\&token=f2b18990-e4d3-4312-8db6-ae0cde3d1681)

Then copy the value and paste in the appropriate field inside the YaySMTP settings area. Add your sub domain in the domain field or get it [from here](https://app.mailgun.com/app/domains). Choose region (**UK** if your site is hosted within Europe or **US** if hosted in US or other regions).

Click **Save Changes.**

![](https://2430774507-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MMvULxRbZfmag_jD1k_%2F-MP6i4QH_Ng5t4w312S2%2F-MP9GGkd80j-ya3HLDjE%2Fimage.png?alt=media\&token=30580a8c-b99a-4a1d-bbe0-94bc53c434bc)
