Wraps Logo
Lovable + Email Guide

How to Send Email from Your Lovable App

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

10 min readWraps Team
10 min
Setup time
$0.10
Per 1,000 emails
0 lines
Of email logic in your app
What you're building
Your Lovable app emits a behavioral event when something happens (user signed up, order placed, payment failed). A Wraps workflow catches it and sends the email. Your app has no email logic — it just says "this happened."

One-time setup

These commands run on your local machine, not inside Lovable. You only do this once.

Set up AWS

If you already have AWS configured, skip this. AWS setup guide →

Deploy email infrastructure

Terminal
npx @wraps.dev/cli email init

Sets up SES in your account and verifies your sending domain. This is where your emails actually send from — your AWS, your domain. Domain verification guide →

Connect to the Wraps Platform

Terminal
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

In the Wraps dashboard, go to Settings → API Keys and create a new key. Name it something like lovable-app.

Copy the key now — it's shown once.
If you lose it, revoke it in the dashboard and create a new one.

Add the key to Lovable (Supabase)

Lovable apps run on Supabase. Go to your Supabase Dashboard → Edge Functions → Secrets and add:

Supabase Edge Functions → Secrets
WRAPS_API_KEY = wraps_a1b2c3d4....<hmac>
Never put the key in your Lovable frontend code.
Lovable apps use Vite — any variable prefixed with VITE_ gets bundled into browser JavaScript and is readable by anyone in DevTools. Edge Function Secrets are only accessible server-side.

Emit events from your app

Create a Supabase Edge Function

Create a track-event Edge Function. Lovable's AI can write this for you — just describe what you want.

supabase/functions/track-event/index.ts
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";

serve(async (req) => {
  const { name, contactEmail, contactName, properties } = await req.json();

  const res = await fetch("https://api.wraps.dev/v1/events/", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${Deno.env.get("WRAPS_API_KEY")}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      name,
      contactEmail,
      contactName,
      createIfMissing: true,
      properties,
    }),
  });

  const data = await res.json();
  return new Response(JSON.stringify(data), {
    headers: { "Content-Type": "application/json" },
  });
});

Call it when things happen in your app

From your Lovable frontend, call the Edge Function when events occur:

Frontend — emit events via your Edge Function
import { supabase } from "@/lib/supabase";

// When a user signs up
await supabase.functions.invoke("track-event", {
  body: {
    name: "user.signed_up",
    contactEmail: user.email,
    contactName: user.name,
    properties: { plan: "free", source: "lovable" },
  },
});

// When an order is placed
await supabase.functions.invoke("track-event", {
  body: {
    name: "order.placed",
    contactEmail: user.email,
    properties: { orderId: order.id, amount: order.total },
  },
});

Set up a workflow in Wraps

In the Wraps dashboard, create a workflow with an event trigger set to your event name (e.g. user.signed_up). Add a Send Email step with your template. That's it — every time your app emits that event, Wraps sends the email.

Custom events guide →

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

Common events to track

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

FAQ

Run npx @wraps.dev/cli email init 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 directly — no Lambda deploy needed.

Ready to Connect Your Lovable App?

Emit events from Lovable. Wraps sends the emails. Your app stays clean.

Related Articles