> ## Documentation Index
> Fetch the complete documentation index at: https://lovable.generaltranslation.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Resend integration

> Learn how to integrate Resend with your Lovable application

## What is Resend?

[Resend](https://resend.com/emails) is an email API built for developers. It focuses on high deliverability, ease of integration, and a clean developer experience for sending transactional and marketing emails.

## Step-by-step tutorial

[YouTube video player](https://www.youtube.com/embed/5ZL744_Wxjo?si=qrKlOL_1fAnz7rgc)

This tutorial walks you through building a fully functional CRM in under an hour—complete with lead collection, email confirmation, newsletter subscription, and an internal admin dashboard. You'll use:

* **Lovable**: to generate the front end and backend logic.
* **Supabase**: for secure data storage and authentication.
* **Resend**: to automate and track transactional + marketing emails.

Let’s get started.

**1. Create a Landing Page with a Contact Form**

Use Lovable's AI to quickly generate a landing page for your product or service.

**Instructions:**

**1. New Lovable Project**

Create a new Lovable project.

**2. Prompt:**

> [!NOTE]
>
> Create a SaaS landing page with a contact form collecting name, email, and message.

![Landing Page Lovable Project Pn](https://mintcdn.com/generaltranslation-d8a08cd1/CqzNmr5z5kHJD2HH/images/landing-page-lovable-project.png?fit=max\&auto=format\&n=CqzNmr5z5kHJD2HH\&q=85\&s=5846c08eb44420537b1d4cd76eccfc4d)

**3. Inspect the generated code**

Inspect the generated code or use the select tool to tweak elements.

**4. Add input validation**

Add input validation and a `message` field for better user experience.

![Email Resend Form Pn](https://mintcdn.com/generaltranslation-d8a08cd1/CqzNmr5z5kHJD2HH/images/email-resend-form.png?fit=max\&auto=format\&n=CqzNmr5z5kHJD2HH\&q=85\&s=dd4374f24288b7b63113b85a41342d51)

**2. Store Form Submissions in Supabase**

Supabase acts as your secure backend database.

**1. Supabase account**

Create a free Supabase account and a new project.

**2. API Key**

In Lovable, connect your Supabase project using the API key.

![Supabase Resend Email Pn](https://mintcdn.com/generaltranslation-d8a08cd1/jw-DadLCPO99GETa/images/supabase-resend-email.png?fit=max\&auto=format\&n=jw-DadLCPO99GETa\&q=85\&s=bfcfb309ad7382c5dadfaca8a3d8b62e)

**3. Create a `contacts` table with:**

* `id`: UUID, primary key
* `name`: text
* `email`: text
* `message`: text
* `created_at`: timestamp

**4. Submission logic**

Modify the form submission logic to insert data into Supabase.

**5. RLS**

Apply Supabase Row-Level Security (RLS) to restrict access to only authenticated users.

**3. Send Confirmation Emails via Resend**

Set up [Resend]() to send automated confirmation emails every time a lead submits the form.

**1. Sign up at Resend**

Sign up at [Resend](https://resend.com) and verify your custom domain.

* You’ll be asked to update your DNS records (TXT, MX).
* Use subdomains like `updates.domain.com` to manage email reputation better.

**2. API Key**

Integrate the API key in Lovable via environment settings or backend function.

**3. SDK**

Use Resend’s SDK to send a confirmation email on form submission.

![Confirmation Email Submission Resend Pn](https://mintcdn.com/generaltranslation-d8a08cd1/CqzNmr5z5kHJD2HH/images/confirmation-email-submission-resend.png?fit=max\&auto=format\&n=CqzNmr5z5kHJD2HH\&q=85\&s=7f497a71fa1d45b928b0a344150be03d)

**4. Optional: React Email**

Use [React Email](https://react.email) (also by Resend) to customize the look and feel of your emails with reusable components.

![Customize Email Resend Pn](https://mintcdn.com/generaltranslation-d8a08cd1/CqzNmr5z5kHJD2HH/images/customize-email-resend.png?fit=max\&auto=format\&n=CqzNmr5z5kHJD2HH\&q=85\&s=65049aae334657f7a5c8c818df90f073)

**4. Build a Secure Admin Dashboard**

Allow only authenticated users to view and manage leads.

**1. Admin route**

Create an `/admin` route in Lovable.

**2. Supabase Authentication**

Enable Supabase authentication with email/password login.

**3. Contacts**

Display the `contacts` table with columns:

* Name
* Email
* Message preview
* Submission date

**4. Full contact detail**

Add a detail pane (e.g., a sliding panel) showing full contact details when a row is clicked.

![Crm Resend Email Pn](https://mintcdn.com/generaltranslation-d8a08cd1/CqzNmr5z5kHJD2HH/images/crm-resend-email.png?fit=max\&auto=format\&n=CqzNmr5z5kHJD2HH\&q=85\&s=cd2a6a56099376bde8a464496d61d8fd)

**5. Redirect logic**

Add redirect logic so unauthenticated users are routed to `/login`.

**5. Enable Custom Email Replies from Admin**

Allow your team to send personalized follow-ups.

**1. Contact detail pane**

In the contact detail pane, add a **text field** and **predefined templates** (e.g., "Thanks for signing up!").

**2. Add send button**

Add a **send button** wired to Resend.

**3. Store sent messages**

Store each sent message in a `sent_emails` table in Supabase:

* `contact_id`
* `subject`
* `body`
* `sent_at`

This gives you a searchable log of all follow-ups.

**6. Add a Newsletter Subscription Form**

Use Resend’s **Audiences** to manage subscribers and send broadcast emails.

![Subscription Newsletter Resend Pn](https://mintcdn.com/generaltranslation-d8a08cd1/jw-DadLCPO99GETa/images/subscription-newsletter-resend.png?fit=max\&auto=format\&n=jw-DadLCPO99GETa\&q=85\&s=9e0da4ae15c51b0b0ad8e76b25550f81)

**1. Add new form**

Add a new form on your landing page for newsletter signup.

**2. Resend contact**

When submitted:

* Create a Resend contact via the API
* (Optional) Store the contact locally in Supabase as well

**3. Design**

Use Resend’s broadcast email UI to design and send newsletters.

* Built-in unsubscribe logic
* Performance insights (open rates, delivery status)

**4. Compliance check!**

For compliance (e.g. GDPR), consider implementing a **double opt-in** flow.

**7. BONUS: Connecting Resend to Supabase Auth**

![Send Batch Emails Gdpr Resend Pn](https://mintcdn.com/generaltranslation-d8a08cd1/jw-DadLCPO99GETa/images/send-batch-emails-gdpr-resend.png?fit=max\&auto=format\&n=jw-DadLCPO99GETa\&q=85\&s=076678596badb62963bde9998b7dc940)

Want to improve Supabase's default email auth (which limits you to 4 emails/hour)?

**1. Resend supabase**

Go to [Resend’s Supabase integration](https://resend.com/integrations/supabase).

**2. Authentication**

Authenticate with your Supabase project.

**3. Domain setup**

Choose your domain and sender name/email.

**4. SMTP**

Resend automatically sets up SMTP and replaces Supabase’s default email system.

**5. Customization**

You can now customize auth email templates from the Supabase dashboard.

**8. Final Touches & Best Practices**

![Audience Resend Pn](https://mintcdn.com/generaltranslation-d8a08cd1/At48MABj-G93zw7Y/images/audience-resend.png?fit=max\&auto=format\&n=At48MABj-G93zw7Y\&q=85\&s=cedef9668d164fadb1ef1375cff459e1)

* **Error Handling**: Lovable might show build errors that are false positives. Always test your functionality live.
* **Reverting with Supabase**: If reverting code in Lovable, remember to manually delete associated Supabase policies or migrations—they're not rolled back automatically.
* **Deliverability Tips**:
  * Use subdomains to isolate reputation.
  * Always include a plain text version of your email.
  * Monitor email performance with Resend's insights dashboard.

**9. You're Done! 🎉**

In less than an hour, you’ve built a modern CRM with:

* A landing page and contact form
* Database-powered lead storage
* Automated email confirmations
* Admin dashboard for lead management
* Custom email replies
* Newsletter broadcasts
* Auth and email verification

## Want to go further?

* Add support for **scheduled emails** via Supabase cron jobs
* Build **automation flows** to trigger emails based on lead stages
* Style your UI for better brand trust and conversion

## Resend integration FAQ

> [accordion] What is Resend?
>
> Resend is an email API built for developers. It focuses on high deliverability, ease of integration, and a clean developer experience for sending transactional and marketing emails.

> [accordion] Do I need a paid Resend plan to follow this tutorial?
>
> No. You can complete the entire CRM setup using **Resend’s free tier**, which supports sending emails from a verified domain and up to 3,000 contacts for marketing emails.

> [accordion] How do I verify a domain in Resend?
>
> Go to Resend → **Domains** → Add your domain. You’ll be given DNS records (TXT, MX) to add via your DNS provider (e.g., Cloudflare, Namecheap). Once added, click **Verify**.
>
> > [!TIP]
> >
> > Use a subdomain like `updates.yourdomain.com` to isolate your email reputation.

> [accordion] Why are my Resend emails going to spam?
>
> There are a few common reasons:
>
> * You haven’t verified your domain
> * Your email lacks a plain-text version
> * You’re sending from a generic sender like `onboarding@resend.dev`
> * You’re not following best practices (e.g., missing unsubscribe links in marketing emails)
>
> Use Resend’s **Deliverability Insights** panel to get actionable tips.

> [accordion] Can I customize the design of the emails I send?
>
> Yes. Use [React Email](https://react.email/)—an open-source library by the Resend team—to design styled, responsive emails with React components.

> [accordion] Does Resend support marketing emails or only transactional?
>
> Resend supports **both**:
>
> * **Transactional emails** (confirmation, reset, notifications) using the API or SDK.
> * **Marketing emails** via the **Broadcast** feature and **Audiences**.
>
> You can create, preview, and track campaigns from the dashboard.

> [accordion] How do I manage newsletter subscribers in Resend?
>
> Use **Audiences**:
>
> * Add contacts manually, via CSV, or programmatically using the API.
> * Each Audience has a unique ID you can use to associate subscriptions.
> * Users can unsubscribe automatically via Resend’s built-in unsubscribe link.

> [accordion] Can I set up double opt-in for newsletters?
>
> Not by default, but you can implement it manually:
>
> 1. On form submission, send an initial confirmation email.
> 2. Ask users to click a link.
> 3. On click, confirm their subscription and add them to your Resend audience.

> [accordion] Can I schedule or automate email flows in Resend?
>
> Not yet. Resend doesn’t currently support drip campaigns or automated sequences.
>
> > [!TIP]
> >
> > Workaround:
> >
> > Use **Supabase Cron Jobs** to schedule tasks that trigger Resend emails at set intervals.

> [accordion] How do I connect Resend to Supabase Auth?
>
> Use the official Supabase Integration by Resend:
>
> 1. Authenticate with your Supabase project.
> 2. Provide a domain and sender name.
> 3. Resend automatically configures your Supabase auth emails to use your Resend account.

> [accordion] How does Resend handle unsubscribes?
>
> Resend automatically processes unsubscribes:
>
> * You must include an unsubscribe link in broadcast emails.
> * When a user unsubscribes, they are removed from the selected audience.
> * This is required for email compliance (e.g., CAN-SPAM, GDPR).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.