Nextmail for Lovable
Send emailwith Lovable.
Paste one prompt and Lovable adds a server route that sends with your Nextmail key.
Add transactional email to this app with Nextmail. 1. Read the API key from the NEXTMAIL_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 nextmail.emails.send. Send from an address on a domain verified in Nextmail. 3. Put the send in a Supabase Edge Function called send-email, and import the SDK as npm:@nextmail/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://nextmail.sh/docs/sdk
Change the sender and the trigger to fit your app. The rest is how Nextmail 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 NEXTMAIL_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, nextmail } from 'npm:@nextmail/sdk'init({ apiKey: Deno.env.get('NEXTMAIL_API_KEY') })Deno.serve(async (request) => {const { email, name, userId } = await request.json()const sent = await nextmail.emails.send({from: 'Acme <hello@acme.com>',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.
Google Workspace