OpenEmail for Lovable
Send emailwith Lovable.
Paste one prompt and Lovable adds a server route that sends with your OpenEmail key.
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.
- 01
Mint a key
Create a key that can send in Settings. The secret shows once.
- 02
Keep it secret
Add OPENEMAIL_API_KEY to the secrets in Lovable, never to the code.
- 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
import { init, openemail } from 'npm:@openemail/sdk'init({ apiKey: Deno.env.get('OPENEMAIL_API_KEY') })Deno.serve(async (request) => {const { email, name, userId } = await request.json()const sent = await openemail.emails.send({from: 'Acme <[email protected]>',to: email,subject: `Welcome, ${name}`,html: `<p>Thanks for signing up, ${name}.</p>`,}, {idempotencyKey: `welcome:${userId}`,})return Response.json({ id: sent.id })})
Other tools
same prompt, same mailbox.
Mint a key.
Send something.
Full API, MCP and SDK access on every plan, the free one included.