OpenEmail for Cursor

Send emailwith Cursor.

Paste one prompt and Cursor installs the SDK, keeps your key on the server and writes the send.

Open Cursor
Prompt for Cursor
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. Keep the send in server code, next to the code that creates users.
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

    Put it in .env as OPENEMAIL_API_KEY and keep .env out of git.

  3. 03

    Paste the prompt

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

What it writes.
One route, one call.

A typical result. Cursor may name the files differently.

lib/email.ts
import { init, openemail } from '@openemail/sdk' init({ apiKey: process.env.OPENEMAIL_API_KEY }) export async function sendWelcome(user: User) {  const sent = await openemail.emails.send({    from: 'Acme <[email protected]>',    to: user.email,    subject: `Welcome, ${user.name}`,    html: `<p>Thanks for signing up, ${user.name}.</p>`,  }, {    idempotencyKey: `welcome:${user.id}`,  })   console.log(sent.id)}

Want Cursor to read your mail too?

Connect it over MCP to search threads, read them and reply, within the access you approve.

Connect Cursor over MCP

Mint a key.
Send something.

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