OpenEmail for v0

Send emailwith v0.

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

Open v0
Prompt for v0
Add transactional email to this app with OpenEmail.

1. Install the TypeScript SDK with npm install @openemail/sdk.
2. 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.
3. Write a sendEmail helper that calls init once, then openemail.emails.send. Send from an address on a domain verified in OpenEmail.
4. Put the send in a Next.js route handler at app/api/send/route.ts.
5. Pass an idempotencyKey built from the event, such as welcome:<userId>, so a retry never sends twice.
6. 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 v0, never to the code.

  3. 03

    Paste the prompt

    v0 installs the SDK and writes the send. Read the change, then run it.

What it writes.
One route, one call.

A typical result. v0 may name the files differently.

app/api/send/route.ts
import { init, openemail } from '@openemail/sdk' init({ apiKey: process.env.OPENEMAIL_API_KEY }) export async function POST(request: 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 })}

Mint a key.
Send something.

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