KBAISE/ for lovable
Library
Docs

Connect your app to Mailgun

about 10 minBuildingchecked 2d agoOfficial page
The short version

Connect your Lovable app to Mailgun to send emails like receipts or notifications using your own verified domain. This lets your app send emails programmatically and track their delivery.

Anyone building an app that needs to send emails from their own domain or manage email delivery details.

Do this, in order

  1. 1

    Sign in to your Mailgun account and go to the 'API keys' section under 'Account' and 'Security'.

    You need a special key from Mailgun that allows Lovable to securely send emails on your behalf.

  2. 2

    Create a new Private API key or copy an existing one, and note whether your Mailgun account is in the EU or US region.

    This key is your app's password to Mailgun, and knowing your region ensures Lovable connects to the correct Mailgun server.

  3. 3

    In Lovable, go to 'Connectors', select 'Mailgun', and click 'Add connection'.

    This starts the process of setting up the link between Lovable and your Mailgun account.

  4. 4

    Give your connection a name, select the correct Mailgun API region (EU or US), and paste your Private API key.

    This tells Lovable how to identify your Mailgun connection and where to send requests.

  5. 5

    Choose who can use this connection in your Lovable workspace, then click 'Connect'.

    This controls access to your Mailgun connection within Lovable, and 'Connect' verifies that everything is set up correctly.

Paste this into your project

Use Mailgun and build a store that sends order confirmation and receipt emails after checkout.

Words decoded

Transactional email
Automated emails sent to individual users based on their actions, like order confirmations, password resets, or shipping notifications, rather than marketing emails.
API
A set of rules and tools that allows different software programs to talk to each other and exchange information.
Sending domain
The part of your email address after the '@' symbol (e.g., 'mydomain.com'). You need to prove to Mailgun that you own this domain before you can send emails from it.
Delivery events
Information about what happens to an email after it's sent, such as whether it was successfully delivered, bounced back, or marked as spam.
Private API key
A secret code that acts like a password, allowing your Lovable app to securely access your Mailgun account and send emails.
DNS
The 'phone book' of the internet, which translates human-readable website names (like example.com) into computer-readable IP addresses. It's also used to verify email sending domains.
DKIM and SPF records
Special entries in your domain's DNS settings that help email providers confirm that emails sent from your domain are legitimate and not spam, improving delivery.
Webhooks
Automated messages sent from one app to another when a specific event happens, like a notification when an email bounces.

Where people get stuck

  • Using a Mailgun Private API key publicly or sharing it insecurely, as it functions like a password.
  • Not having a verified sending domain set up in your Mailgun account before trying to send emails.
  • Selecting the wrong Mailgun API region (EU or US) when connecting to Lovable, which will prevent authentication.
  • Expecting Lovable to verify or register sending domains for you; this must be done directly in Mailgun.
  • Trying to receive Mailgun event webhooks directly through the Lovable connector; you need to poll the Mailgun events API or set up webhooks to an external endpoint.

The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.