Skip to main content
Mailgun is a transactional email service that lets your Lovable app send email programmatically over the Mailgun API. It’s designed for apps that need reliable delivery for receipts, notifications, password resets, alerts, and reports, with detailed tracking for bounces, complaints, and unsubscribes. Mailgun is available as an app + chat connector: one shared connection that works in the chat while you build and in your published apps. With Mailgun, your app can:
  • Send transactional email through the Mailgun API
  • Send from a verified sending domain you manage in Mailgun
  • Track delivery events such as bounces, complaints, and unsubscribes
  • Read message and event metadata for auditing or in-app status
  • Read domain and route information from your Mailgun account
Mailgun is a good fit when you want to send from your own domain, keep control of your sender reputation, or already manage your sending in Mailgun.
For standard transactional emails (signup confirmations, password resets, receipts, internal notifications), use the built-in Lovable Emails.Reach for the Mailgun connector when you want to send from your own verified domain, scale beyond Lovable Emails, or you already manage your sending in Mailgun.

Common use cases and example apps

How to connect Mailgun

Workspace admins and owners can connect Mailgun. You can create multiple Mailgun connections using different API keys, which is useful for separating environments (for example, development and production), targeting different Mailgun accounts, or using keys with different rate limits. When the connection is created, Mailgun becomes available across all projects in the workspace.

Prerequisites

Before connecting Mailgun, make sure you have:
  • A Mailgun account
  • A verified sending domain in that Mailgun account
  • A Mailgun Private API key
  • The region where your Mailgun account is hosted (EU or US)
  • Lovable workspace owner or admin role
All email sent through this connector counts toward your Mailgun plan and is billed by Mailgun, not Lovable.

Step 1: Get a Mailgun Private API key

A Private API key lets your Lovable app authenticate with the Mailgun API. You can create separate keys for different environments or apps. To create a Mailgun Private API key:
1

Open your Mailgun account

Sign in to the Mailgun app with the account that owns your sending domain.
2

Open API keys

Go to Account → Security → API keys.
3

Create or copy a Private API key

Create a new Private API key (give it a descriptive name, for example Lovable integration) or copy an existing one.
4

Note your account region

Note whether your Mailgun account is hosted in the EU or US region. You’ll need to select the matching region in Lovable.
Your Private API key functions like a password. Keep it secure and never share it publicly. You’ll need it in the next step.
See Mailgun documentation for detailed instructions: Mailgun API reference.

Step 2: Connect Mailgun to Lovable

You can create multiple connections using different API keys.
1

Open Mailgun in Connectors

Go to Connectors and select Mailgun.
2

Add a connection

Click Add connection.
3

Configure the connection

  1. Display name: name the connection, for example Mailgun Prod.
  2. API region: select the region your Mailgun account is hosted in (European Union or United States). The default is European Union. The region must match the account the API key belongs to. A US key will not authenticate against the EU API.
  3. Private API key: paste your Mailgun Private API key.
  4. Who can access this connection: keep access limited to specific people or invite the entire workspace. See Who can manage connections for more information.
4

Connect

Click Connect.
When connected, your Lovable apps can start sending email and reading account data through Mailgun.

Sending from your domain

Mailgun sends email from domains you’ve verified in your Mailgun account. The connector does not configure DNS or verify domains for you. Before sending, make sure your sending domain is set up in the Mailgun app and shows as verified, with the required DKIM and SPF records added at your DNS provider. When prompting Lovable, mention the domain you want to send from (for example, noreply@mydomain.com) so the generated app uses it consistently.

Limitations

The Mailgun connector cannot:
  • Verify or register sending domains for you (configure these in the Mailgun app first)
  • Receive Mailgun event webhooks directly through the connector (you can poll Mailgun’s events API instead, or configure webhooks to a Mailgun-side endpoint outside Lovable)
  • Refresh or rotate API keys automatically. To rotate, generate a new key in Mailgun and update the Lovable connection
  • Support per-end-user Mailgun authentication (each connection uses a single shared API key, scoped to the workspace)
  • Use more than one region per connection (a single connection authenticates against either the EU or US Mailgun API)

Manage your connection

Connections are managed from Connectors: select , then open the connection.
  • Unlink projects to remove access from specific projects while keeping the connection available for others. See Unlink projects from a connection for the steps.
  • Delete the connection to remove it from the workspace entirely. Deleting is permanent. It removes the credentials from all linked projects, and app features that use stop working until a new connection is added. See Delete a connection for the steps and who can delete.