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

# Send program emails with Mailgun

> Use your own Mailgun account and domain to send your program's emails

Mailgun is one of the email gateways Partnero can send your program's emails through. Connecting your Mailgun
account lets those emails go out from any active domain in that account, such as *[partners@yourdomain.com](mailto:partners@yourdomain.com)*,
instead of the default *@partnero.email* address.

> [!NOTE]
>
> This is about **sending email**, not syncing data. Mailgun does not receive your partners or customers. For
> that, see [Mailchimp](https://docs.partnero.com/integrations/mailchimp.md) or [MailerLite](https://docs.partnero.com/integrations/mailerlite.md).

## Before you start

You need:

* A **private API key** from Mailgun. Domain sending keys are not supported, because Partnero also needs to list
  your domains. See [Mailgun's guide to API keys](https://documentation.mailgun.com/docs/mailgun/user-manual/api-key-mgmt/rbac-mgmt).
  The key's role must be allowed to send email, so read-only roles such as Analyst will not work.
* At least one **active (verified) sending domain** in Mailgun.
* To know which **region** your Mailgun account is in: US or EU.

## Connect Mailgun

1. In your program, go to **Emails** under Affiliate.
2. On the **Settings** tab, click **Setup** next to **Use Mailgun**.
3. Paste your Mailgun API key.
4. Under **Region**, choose **US (api.mailgun.net)** or **EU (api.eu.mailgun.net)** to match your Mailgun account.
5. Click **Connect**.

Partnero checks that the key works in the selected region and is allowed to send email. Once connected, Mailgun
shows a green checkmark.

## Choose your sender

Connecting the gateway does not change which address your emails come from.

1. Under **Sender email**, open the domain list and pick a domain from the **Mailgun domains** group. Every
   active domain in your Mailgun account is listed.
2. In the field before the **@**, type the part of the address you want to send from, for example `partners`.
3. Click **Update** to save.

> [!TIP]
>
> Click **Send test email** below the email gateways to confirm everything works before your partners start
> receiving emails.

## Disconnecting

Click **Disconnect** next to **Use Mailgun** and confirm. Your API key is removed from Partnero.

If Mailgun was sending your program's emails, your sender email switches back to Partnero's default
*@partnero.email* address, so your emails keep going out. Your Mailgun domains are no longer selectable until you
connect again.

## Troubleshooting

> [accordion] Your API key is not valid for the selected region
>
> Mailgun keys work in both regions, but your domains only exist in one of them. Try connecting again with the
> other region selected. Also make sure you are using a private API key, not a domain sending key, and that
> the key's role can send email.

> [accordion] Emails still come from the old address
>
> Connecting the gateway and choosing the sender are two separate steps. Go back to **Sender email**, pick a
> domain from the **Mailgun domains** group, and click **Update**.

> [accordion] My domain is missing from the list
>
> Only active domains are listed. Finish verifying the domain's DNS records in Mailgun, then reload the
> **Emails** settings page.

> [accordion] Test emails to some addresses are rejected
>
> Mailgun's sandbox domain only delivers to authorized recipients that you add in Mailgun. Send from your own
> verified domain instead, or add the recipient as an authorized recipient in Mailgun.

## Next steps

> [card] [Email settings](https://docs.partnero.com/knowledge-base/program-emails/email-settings.md)
>
> Sender name, reply-to address and email styling

> [card] [Program emails](https://docs.partnero.com/knowledge-base/getting-started/program-email-notifications.md)
>
> Which emails Partnero sends


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.