---
title: "OpenEmail for Lovable"
description: "Add email to the app you build with Lovable: one prompt, an API key and the OpenEmail SDK, with sending, threads and webhooks."
url: "https://openemail.uk/developers/lovable"
---

[All developer tools](https://openemail.uk/developers.md)

OpenEmail for Lovable

# Send emailwith Lovable.

Paste one prompt and Lovable adds a server route that sends with your OpenEmail key.

[Open Lovable](https://lovable.dev)

Prompt for Lovable

```
Add transactional email to this app with OpenEmail.

1. Read the API key from the OPENEMAIL_API_KEY environment variable, on the server only. Never send it to the browser and never commit it.
2. Write a sendEmail helper that calls init once, then openemail.emails.send. Send from an address on a domain verified in OpenEmail.
3. Put the send in a Supabase Edge Function called send-email, and import the SDK as npm:@openemail/sdk.
4. Pass an idempotencyKey built from the event, such as welcome:<userId>, so a retry never sends twice.
5. Send a welcome email when someone signs up, and log the id that comes back.

SDK reference: https://openemail.uk/docs/sdk
```

Change the sender and the trigger to fit your app. The rest is how OpenEmail expects to be called.

## Three steps, then it sends.

1. 01
   
   Mint a key
   
   Create a key that can send in Settings. The secret shows once.
2. 02
   
   Keep it secret
   
   Add OPENEMAIL\_API\_KEY to the secrets in Lovable, never to the code.
3. 03
   
   Paste the prompt
   
   Lovable installs the SDK and writes the send. Read the change, then run it.

## What it writes. One route, one call.

A typical result. Lovable may name the files differently.

supabase/functions/send-email/index.ts

```
1import { init, openemail } from 'npm:@openemail/sdk'2 3init({ apiKey: Deno.env.get('OPENEMAIL_API_KEY') })4 5Deno.serve(async (request) => {6  const { email, name, userId } = await request.json()7 8  const sent = await openemail.emails.send({9    from: 'Acme <hello@acme.com>',10    to: email,11    subject: `Welcome, ${name}`,12    html: `<p>Thanks for signing up, ${name}.</p>`,13  }, {14    idempotencyKey: `welcome:${userId}`,15  })16 17  return Response.json({ id: sent.id })18})
```

## Other tools same prompt, same mailbox.

- [Claude Code Coding agent Ask Claude Code to add sending to your codebase.](https://openemail.uk/developers/claude-code.md)
- [Cursor Coding agent Let the Cursor agent wire up sending in your repo.](https://openemail.uk/developers/cursor.md)
- [Codex Coding agent Hand Codex the prompt and review the change it makes.](https://openemail.uk/developers/codex.md)
- [GitHub Copilot Coding agent Paste the prompt into Copilot agent mode in VS Code.](https://openemail.uk/developers/github-copilot.md)
- [Windsurf Coding agent Let Cascade add sending to your project.](https://openemail.uk/developers/windsurf.md)
- [Gemini CLI Coding agent Run the prompt in Gemini CLI from your project folder.](https://openemail.uk/developers/gemini-cli.md)
- [T3 Code Coding agent Paste the prompt into a T3 Code thread and review the diff.](https://openemail.uk/developers/t3-code.md)
- [v0 App builder Add a send route to the Next.js app v0 builds.](https://openemail.uk/developers/v0.md)
- [Bolt App builder Give the app Bolt builds a server route that sends.](https://openemail.uk/developers/bolt.md)
- [Replit App builder Add an Express route that sends from your Replit app.](https://openemail.uk/developers/replit.md)
- [Modulify App builder Add a send route to the Next.js site Modulify builds.](https://openemail.uk/developers/modulify.md)

## Mint a key. Send something.

Full API, MCP and SDK access on every plan, the free one included.

[Open mail](https://openemail.uk/mail/inbox) [Get Started](https://openemail.uk/signup.md)[Read the API quickstart](https://openemail.uk/docs/api/quickstart.md)
