Nextmail for Replit
Send emailwith Replit.
Paste one prompt and Replit adds a server route that sends with your Nextmail key.
Add transactional email to this app with Nextmail. 1. Install the TypeScript SDK with npm install @nextmail/sdk. 2. 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. 3. Write a sendEmail helper that calls init once, then nextmail.emails.send. Send from an address on a domain verified in Nextmail. 4. Put the send in an Express route at POST /api/send. 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://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 Replit, never to the code.
- 03
Paste the prompt
Replit installs the SDK and writes the send. Read the change, then run it.
What it writes.
One route, one call.
A typical result. Replit may name the files differently.
server/index.ts
import express from 'express'import { init, nextmail } from '@nextmail/sdk'init({ apiKey: process.env.NEXTMAIL_API_KEY })const app = express()app.use(express.json())app.post('/api/send', async (req, res) => {const { email, name, userId } = req.bodyconst 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}`,})res.json({ id: sent.id })})app.listen(3000)
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