# How to Send Email from Your Lovable App

Source: https://wraps.dev/blog/lovable-send-email

Lovable + Email Guide

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 read•Wraps 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 →](https://wraps.dev/docs/guides/aws-setup)

### Deploy email infrastructure

Terminal Copy

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 →](https://wraps.dev/docs/guides/domain-verification)

### Connect to the Wraps Platform

Terminal Copy

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](https://app.wraps.dev), 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 Copy

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 Copy

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 Copy

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 →](https://wraps.dev/docs/guides/custom-events)

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

| Event | Triggers |
| --- | --- |
| `user.signed_up` | Welcome email |
| `order.placed` | Order confirmation |
| `password.reset_requested` | Password reset email |
| `subscription.cancelled` | Win-back sequence |
| `trial.ending` | Upgrade nudge |

## FAQ

Do I need to deploy anything to AWS?

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.

Can I call the Wraps API directly from my Lovable frontend?

What's the difference between emitting an event and sending an email?

What does this cost?

Can Lovable's AI write the Edge Function for me?

How do I get out of the SES sandbox?

### Ready to Connect Your Lovable App?

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

[Custom Events Guide](https://wraps.dev/docs/guides/custom-events)[Open Wraps Dashboard](https://app.wraps.dev)

## Related Articles

[Sending Email from AI-Built Apps](https://wraps.dev/blog/vibe-coding-email)[How to Send Email from Your Bolt.new App](https://wraps.dev/blog/bolt-send-email)[4 Email Flows Your Supabase App Needs](https://wraps.dev/blog/supabase-email-guide)
