> ## Documentation Index
> Fetch the complete documentation index at: https://laudspeaker.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Mailgun

Laudspeaker customers can use their [Mailgun](https://mailgun.com) account to send email through Laudspeaker, as well as keep track of email sending metrics like open and click-through rates.

<Info>Mailgun offers both an SMTP client and an HTTP API. If you wish to use Mailgun's SMTP client, see our SMTP connection docs [here](/docs/integrate/messaging-channels/email/smtp). For connecting with the Mailgun HTTP API, follow the guide below.</Info>

## Before We Begin: Creating an account

Before we can send emails using Mailgun, we must create a Mailgun account. Go to Mailgun's [signup page](https://signup.mailgun.com/new/signup) and fill in the required information.

<Warning>Mailgun requires new users to enter their payment information. For a completely free option, check out Laudspeaker's [email sandbox channel](/docs/integrate/messaging-channels/email/sandbox).</Warning>

## Registering Sending Domains and Adding Authorized Recipients

### Sandbox Domain

Each new Mailgun account is automatically provisioned with a *sandbox domain* of the form `sandbox<alphanumeric-identifier>@mailgun.org`. This domain allows you to perform all the core actions Mailgun offers without having to purchase or setup your own domain. All of Laudspeaker's functionality remains accessible using a sandbox domain.

Once you are ready, you can verify a domain for sending emails in production using the Mailgun [domain verification documentation](https://documentation.mailgun.com/en/latest/user_manual.html#verifying-your-domain-1).

### Adding Authorized Recipients

<Check> If you are not using a sandbox domain, you can skip this step.</Check>

If you are using a sandbox domain, you will have to create *authorized recipients* in Mailgun. These are verified emails that you can send to using the sandbox domain, and you can have up to five of them.

To add an authorized recipient, follow the instructions in [this article](https://help.mailgun.com/hc/en-us/articles/217531258-Authorized-Recipients).

## Activating Webhooks

To receive *opened*, *clicked*, and *unsubscribed* events, you will need to activate **Click Tracking**, **Open Tracking**, and **Unsubscribes** in the Mailgun UI.

1. From the [Mailgun Dashboard](https://app.mailgun.com/mg/dashboard), navigate to `Domain Settings` in the `Sending` drop-down menu, and select the domain you will be sending from in the top right corner of the screen:
   <img src="https://mintcdn.com/laudspeaker/In84ceyly56-IgdR/images/channel-setup/mailgun-domain-settings-menu.png?fit=max&auto=format&n=In84ceyly56-IgdR&q=85&s=4399f5532c39eda087c63cf92536a213" alt="Mailgun Domain Settings Menu" width="254" height="545" data-path="images/channel-setup/mailgun-domain-settings-menu.png" />
   <img src="https://mintcdn.com/laudspeaker/In84ceyly56-IgdR/images/channel-setup/mailgun-domain-selection.png?fit=max&auto=format&n=In84ceyly56-IgdR&q=85&s=547598f824341aa9b8b9e899000cc170" alt="Mailgun Domain Selection" width="326" height="72" data-path="images/channel-setup/mailgun-domain-selection.png" />

2. Scroll down to the `Tracking` section of the domain settings page and turn on `Click Tracking`, `Open Tracking`, and `Unsubscribes`:
   <img src="https://mintcdn.com/laudspeaker/In84ceyly56-IgdR/images/channel-setup/mailgun-tracking-settings.png?fit=max&auto=format&n=In84ceyly56-IgdR&q=85&s=f14c64e469eca562dc767192f0b5e212" alt="Activating Mailgun Tracking" width="1066" height="295" data-path="images/channel-setup/mailgun-tracking-settings.png" />

## Connecting Mailgun to Laudspeaker

Now that you are finished setting up your Mailgun account, it's time to start sending emails!

1. Navigate to the [Mailgun API keys page](https://app.mailgun.com/app/account/security/api_keys), and copy your **Private API key**:
   <img src="https://mintcdn.com/laudspeaker/In84ceyly56-IgdR/images/channel-setup/mailgun-api-key.png?fit=max&auto=format&n=In84ceyly56-IgdR&q=85&s=639f10ca1f6eeb234bee9358e884898f" alt="Mailgun API Key" width="943" height="171" data-path="images/channel-setup/mailgun-api-key.png" />

2. Go to the [settings menu](https://app.laudspeaker.com/settings) in Laudspeaker, click on the `Email` tab, and then select `Mailgun` and input your API key in the `Mailgun API Key` field:
   <img src="https://mintcdn.com/laudspeaker/In84ceyly56-IgdR/images/channel-setup/laudspeaker-mailgun-settings.png?fit=max&auto=format&n=In84ceyly56-IgdR&q=85&s=eb7399496d6995dc0fd27e7ec9d38b09" alt="Laudspeaker Mailgun Settings" width="1206" height="418" data-path="images/channel-setup/laudspeaker-mailgun-settings.png" />

3. Select the domain that you would like to send emails from using the Domain dropdown, and input the sending name and sending email.

4. Save your settings. This will automatically create all the webhooks you need to receive tracking events.

5. Start sending!
