LovableResendIntermediate8 min read

How to Send Emails from Your Lovable App with Resend

Send transactional emails like welcome messages and receipts from your Lovable app using Resend and Supabase Edge Functions.

Before you start

  • A Lovable account with a Supabase-connected app
  • A Resend account (free at resend.com)
  • A verified domain in Resend (or use the onboarding@resend.dev test address)

Step by step

1

Get your Resend API key

In the Resend dashboard, go to API Keys and create a new key. Copy it.

RESEND_API_KEY=re_your_key_here
2

Add the key to Supabase secrets

Go to Supabase → Edge Functions → Secrets. Add RESEND_API_KEY with your key.

# Supabase Dashboard → Edge Functions → Secrets
# Name: RESEND_API_KEY
# Value: re_your_key_here
3

Create the send-email Edge Function

Ask Lovable to create a Supabase Edge Function that sends emails via Resend.

Paste this into Lovable:

Create a Supabase Edge Function called 'send-email' that:
1. Accepts to, subject, and html in the request body
2. Sends the email using the Resend API with fetch (POST to https://api.resend.com/emails)
3. Uses RESEND_API_KEY from environment variables
4. Sends from 'hello@yourdomain.com'
5. Returns the Resend response
6. Has proper CORS headers
4

Send a welcome email on signup

Trigger a welcome email when a new user signs up by calling the Edge Function from your auth flow.

Paste this into Lovable:

After a user successfully signs up, call the send-email Edge Function with:
- to: the user's email
- subject: 'Welcome to [App Name]!'
- html: a nice welcome email with their name and a link to get started
5

Test the email flow

Sign up with a test account and verify you receive the welcome email. Check the Resend dashboard for delivery logs if it doesn't arrive.

Paste this into Lovable:

Add a test button on the settings page that sends a test email to the current user's email address using the send-email Edge Function.

Common errors

403 Forbidden from Resend

Your domain isn't verified in Resend, so you can't send from that address.

Fix: Verify your domain in Resend → Domains, or send from onboarding@resend.dev for testing.

Edge Function timeout

The Edge Function takes too long to respond.

Fix: Make sure you're awaiting the fetch call and not doing anything else in the function. Resend responses are fast.

Email lands in spam

Without proper DNS records, emails go to spam.

Fix: Set up SPF, DKIM, and DMARC records for your domain in Resend → Domains.

Related guides

Weekly Newsletter

Get next week's fix before you need it.

Join developers getting weekly vibe coding tips, error fixes, and tool updates.

Subscribe on Substack →