Wraps Logo
Replit + Email Guide

How to Send Email from Your Replit App

You built it in Replit. Now users need a welcome email, a receipt, a password reset. Here's how to wire it up in 10 minutes — without writing email logic in your app.

10 min readWraps Team
10 min
Setup time
$0.10
Per 1K emails
0 lines
Of email logic
What you're building
Your Replit server emits a behavioral event when something happens. A Wraps workflow catches it and sends the email. Your app has no email logic — it just says "this happened."

One-time setup (local terminal)

Important
wraps email init runs on your local machine. Replit doesn't need your AWS credentials — only your local terminal does, and only during this one-time setup.

Set up AWS

Create an AWS account and configure the AWS CLI on your local machine. AWS setup guide →

Deploy email infrastructure

This sets up SES in your AWS account — where your emails actually send from. Your Replit app never touches AWS directly. Domain verification guide →

Terminal (your local machine)
npx @wraps.dev/cli email init

Connect to the Wraps Platform

Terminal (your local machine)
npx @wraps.dev/cli platform connect

Creates a cross-account IAM role so the Wraps Platform can send email through your SES when a workflow fires. Run this once — re-run wraps platform update-role if you add new features later.

Get a Wraps API key

Go to app.wraps.dev → Settings → API Keys and create a key named replit-app.

Copy the key now — it's shown once
The full key is only displayed at creation time. Copy it before closing the dashboard.

Add the key to Replit

In the Replit editor, click the lock icon in the left sidebar. Add:

Replit Secrets tab (lock icon in sidebar)
WRAPS_API_KEY = wraps_a1b2c3d4....<hmac>
Don't hardcode the key in your Replit code
Replit Secrets are the right place: accessible via process.env in your server, but never sent to the browser or committed to the project.

Emit events from your server

Install the SDK in your Replit project:

Terminal (in Replit)
npm install @wraps.dev/client

Create a shared client module:

lib/wraps.js
import { createPlatformClient } from "@wraps.dev/client";

export const wraps = createPlatformClient({
  apiKey: process.env.WRAPS_API_KEY,
});

Call wraps.track() from your Express routes when something meaningful happens:

server.js (add to your Express routes)
import { wraps } from "./lib/wraps.js";

// Emit when a user signs up
app.post("/api/signup", async (req, res) => {
  const { email, name } = req.body;
  // ... create user ...

  await wraps.track("user.signed_up", {
    contactEmail: email,
    contactName: name,
    createIfMissing: true,
    properties: { source: "replit", plan: "free" },
  });

  res.json({ success: true });
});

// Emit when an order is placed
app.post("/api/orders", async (req, res) => {
  // ... process order ...

  await wraps.track("order.placed", {
    contactEmail: req.user.email,
    properties: { orderId: order.id, amount: order.total },
  });

  res.json({ order });
});

Set up a workflow in Wraps

In the Wraps dashboard:

  1. 1Dashboard → Workflows → New workflow
  2. 2Trigger: Event received user.signed_up
  3. 3Step: Send email → choose template

See the custom events guide for the full workflow reference.

Common events to track

One event per meaningful moment. Wraps workflows handle the rest.

EventSends
user.signed_upWelcome email
order.placedOrder confirmation
password.reset_requestedPassword reset
subscription.cancelledWin-back sequence
trial.endingUpgrade nudge

FAQ

Run wraps email init on your local machine to set up SES, then wraps platform connect to give Wraps permission to send through your SES in workflows. After that, your app calls api.wraps.dev via the SDK — no Lambda deploy, no Function URL to manage.

Ready to Connect Your Replit App?

Emit your first event and let Wraps handle the rest. No email logic in your code.

Related Articles