---
layout: integration
title: Email with Mailgun
description: Send customized emails to your users through Mailgun
date: 2026-11-06
featured: false
isPartner: true
isNew: true
cover: /images/integrations/email-mailgun/cover.avif
category: messaging
product:
    vendor: Mailgun
    description: "Mailgun is an email delivery platform with APIs for sending, receiving, and tracking transactional and bulk email."
platform:
    - 'Self-hosted'
    - 'Cloud'
---

[Mailgun](https://www.mailgun.com) is an email delivery platform for developers. It provides APIs and an SMTP relay for sending, receiving, and tracking email, and it hosts each of your sending domains in either its US or its EU region.

# How does the integration work?

You can use the Mailgun provider in Appwrite Messaging to send customized emails to your users, such as reminders, promotions, announcements, and custom authentication flows. Emails can be sent immediately or scheduled, to [topics](/docs/products/messaging/topics), users, or individual [targets](/docs/products/messaging/targets).

Appwrite sends through the Mailgun API with your API key and sending domain. When you mark the domain as an EU domain, Appwrite calls Mailgun's EU API endpoint instead of the US one.

# How to implement

To implement the Mailgun provider in Appwrite Messaging, there are several steps you must complete:

## Step 1: Set up Mailgun

First, [sign up for a Mailgun account](https://signup.mailgun.com/new/signup). In the Mailgun dashboard, go to **Sending** > **Domains**, add the domain you want to send from, and [verify it](https://documentation.mailgun.com/docs/mailgun/user-manual/domains/domains-verify) by adding the DNS records Mailgun shows you. Note whether the domain is in the US or the EU region.

Next, open your profile menu, select **API Security**, and create a new API key. Mailgun shows the key only once, so save it for the next step.

## Step 2: Add the Mailgun provider to your Appwrite project

For this step, you must [create an account on Appwrite Cloud](/sign-up) or [self-host Appwrite](/docs/advanced/self-hosting) if you haven't already. In your Appwrite project, head to **Messaging** > **Providers**, click **Add provider**, and choose **Email**. Give your provider a name, choose **Mailgun**, and click **Save and continue**.

In the **Configure** step, fill in the following fields:

| Field name | |
| --- | --- |
| API key | The API key you created in the Mailgun dashboard. |
| Domain | The sending domain you verified in Mailgun. |
| EU region | Turn this on if your domain is in Mailgun's EU region. |
| Sender email | The provider sends emails from this address. It must be an email under the configured domain. |
| Sender name | The sender name that appears in the emails sent from this provider. |
| Reply-to email | The reply-to email that appears in the emails sent from this provider. It must be an email under the configured domain. |
| Reply-to name | The reply-to name that appears in the emails sent from this provider. |

Click **Save and continue** to enable the provider.

## Step 3: Test the Mailgun provider

Before you proceed, you must already have at least one [topic](/docs/products/messaging/topics) or [target](/docs/products/messaging/targets) set up.

Go to **Messaging** > **Messages**, click **Create message**, and choose **Email**. Write a test message, select one of your test targets, set the schedule to **Now**, and click **Send**. Check that the email arrives in your inbox. If it doesn't, check the logs in the Appwrite Console and in your Mailgun dashboard.

To send emails from your backend instead, follow the [Send email messages](/docs/products/messaging/send-email-messages) guide with an [Appwrite Server SDK](/docs/sdks#server).

# Read more about Mailgun and Appwrite Messaging

If you would like to learn more about Mailgun and Appwrite Messaging, we have some resources that you should visit:

- [Mailgun documentation](https://documentation.mailgun.com/docs/mailgun/get-started)
- [Set up the Mailgun provider in Appwrite Messaging](/docs/products/messaging/mailgun)
- [Send email messages through Appwrite Messaging](/docs/products/messaging/send-email-messages)
- [Appwrite Messaging API reference](/docs/references/cloud/server-nodejs/messaging)
