Send emails
with SvelteKit

Built for SvelteKit

Resend drops straight into any SvelteKit app. Send emails from a server endpoint using the Node SDK and your private environment variables, safely away from the browser.

import { json } from '@sveltejs/kit';
import { RESEND_API_KEY } from '$env/static/private';
import { Resend } from 'resend';
const resend = new Resend(RESEND_API_KEY);
export async function POST({ request }) {
const { email } = await request.json();
const { data, error } = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: [email],
subject: 'Hello world',
html: '<strong>It works!</strong>',
});
if (error) {
return json({ error }, { status: 400 });
}
return json(data);
}
import { fail } from '@sveltejs/kit';
import { RESEND_API_KEY } from '$env/static/private';
import { Resend } from 'resend';
const resend = new Resend(RESEND_API_KEY);
export const actions = {
default: async ({ request }) => {
const form = await request.formData();
const email = form.get('email');
const { error } = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: [email],
subject: 'Hello world',
html: '<strong>It works!</strong>',
});
if (error) {
return fail(400, { error: error.message });
}
return { success: true };
},
};

Send form emails with form actions

Handle form submissions on the server with SvelteKit form actions. Read the submitted data, send the email with Resend, and return validation results without shipping any client-side JavaScript.

Progressive enhancement built in

Pair your action with SvelteKit's use:enhance so the form works with plain HTML and gets a smoother experience once JavaScript loads. Deploy anywhere SvelteKit runs, from Node servers to edge functions.

<script>
import { enhance } from '$app/forms';
export let form;
</script>
<form method="POST" use:enhance>
<input type="email" name="email" placeholder="you@example.com" />
<button type="submit">Send email</button>
</form>
{#if form?.success}
<p>Your email is on its way.</p>
{/if}

All you need to get started

Resources to help you integrate email into your application quickly.

SvelteKit Quickstart

Follow the step-by-step guide and learn how to send your first email using SvelteKit.

SvelteKit example

Clone the example repository to get started quickly with Resend using SvelteKit.

API reference

Understand the REST API endpoints and each of the parameters that can be used.

  • "Our team loves Resend. It makes email sending so easy and reliable. After we switched to Dedicated IPs, our deliverability improved tremendously and we don't hear complaints about emails landing on spam anymore."
    Vlad MatsiiakoCo-founder of Infisical
  • "As a developer I love the approach that the Resend team is taking. Its so refreshing. They are also extremely user-centric and helpful in terms of getting you up and running, sending beautiful emails that deliver."
    Hahnbee LeeCo-Founder at Mintlify
  • "We value tools that feel stable, well thought out, and aligned with the standards we expect across our stack. Resend meets those expectations. It lets our team stay focused on building the larger platform rather than getting pulled into the overhead that typically comes with legacy email infrastructure."
    Bradley GreenwoodVP of Engineering at MrBeast
  • "Our partnership with Resend has been a great experience. They've made sure we can focus on what we do best—building our product and growing our business."
    Sahil LavingiaCEO of Gumroad
  • "Switching over to Resend from SendGrid marked a significant improvement in our email management. We started with a small test - waitlist emails for our iOS and Windows apps. Within 30 minutes, we were done."
    Thomas MannFounder & CEO of Raycast
  • "The simplicity and reliability of Resend allowed our engineers to focus on building features rather than troubleshooting email infrastructure."
    Amadeo PellicceConnectors, Agents and Automations Lead at Replit
  • "We're a small team with a lot on our plates. Email infrastructure is something we don't want to think about, and with Resend we don't have to."
    Peter SuhmOps at Tailwind
  • "The best part about taking Resend into production was that there was no friction at all."
    Tara NagarSoftware Engineer at Braintrust
  • "The flexibility of Resend is what we value most. It allows us to quickly adapt and refine our email communications as our products evolve."
    Glauber CostaFounder and CEO at Turso
  • "Resend is email with simpler APIs, better webhooks, and best-in-class debugging."
    Dan FarrellyCTO and Co-Founder of Inngest
  • "Our team loves Resend. It makes email sending so easy and reliable. After we switched to Dedicated IPs, our deliverability improved tremendously and we don't hear complaints about emails landing on spam anymore."
    Vlad MatsiiakoCo-founder of Infisical
  • "As a developer I love the approach that the Resend team is taking. Its so refreshing. They are also extremely user-centric and helpful in terms of getting you up and running, sending beautiful emails that deliver."
    Hahnbee LeeCo-Founder at Mintlify
  • "We value tools that feel stable, well thought out, and aligned with the standards we expect across our stack. Resend meets those expectations. It lets our team stay focused on building the larger platform rather than getting pulled into the overhead that typically comes with legacy email infrastructure."
    Bradley GreenwoodVP of Engineering at MrBeast
  • "Our partnership with Resend has been a great experience. They've made sure we can focus on what we do best—building our product and growing our business."
    Sahil LavingiaCEO of Gumroad
  • "Switching over to Resend from SendGrid marked a significant improvement in our email management. We started with a small test - waitlist emails for our iOS and Windows apps. Within 30 minutes, we were done."
    Thomas MannFounder & CEO of Raycast
  • "The simplicity and reliability of Resend allowed our engineers to focus on building features rather than troubleshooting email infrastructure."
    Amadeo PellicceConnectors, Agents and Automations Lead at Replit
  • "We're a small team with a lot on our plates. Email infrastructure is something we don't want to think about, and with Resend we don't have to."
    Peter SuhmOps at Tailwind
  • "The best part about taking Resend into production was that there was no friction at all."
    Tara NagarSoftware Engineer at Braintrust
  • "The flexibility of Resend is what we value most. It allows us to quickly adapt and refine our email communications as our products evolve."
    Glauber CostaFounder and CEO at Turso
  • "Resend is email with simpler APIs, better webhooks, and best-in-class debugging."
    Dan FarrellyCTO and Co-Founder of Inngest
  • "Our team loves Resend. It makes email sending so easy and reliable. After we switched to Dedicated IPs, our deliverability improved tremendously and we don't hear complaints about emails landing on spam anymore."
    Vlad MatsiiakoCo-founder of Infisical
  • "As a developer I love the approach that the Resend team is taking. Its so refreshing. They are also extremely user-centric and helpful in terms of getting you up and running, sending beautiful emails that deliver."
    Hahnbee LeeCo-Founder at Mintlify
  • "We value tools that feel stable, well thought out, and aligned with the standards we expect across our stack. Resend meets those expectations. It lets our team stay focused on building the larger platform rather than getting pulled into the overhead that typically comes with legacy email infrastructure."
    Bradley GreenwoodVP of Engineering at MrBeast
  • "Our partnership with Resend has been a great experience. They've made sure we can focus on what we do best—building our product and growing our business."
    Sahil LavingiaCEO of Gumroad
  • "Switching over to Resend from SendGrid marked a significant improvement in our email management. We started with a small test - waitlist emails for our iOS and Windows apps. Within 30 minutes, we were done."
    Thomas MannFounder & CEO of Raycast
  • "The simplicity and reliability of Resend allowed our engineers to focus on building features rather than troubleshooting email infrastructure."
    Amadeo PellicceConnectors, Agents and Automations Lead at Replit
  • "We're a small team with a lot on our plates. Email infrastructure is something we don't want to think about, and with Resend we don't have to."
    Peter SuhmOps at Tailwind
  • "The best part about taking Resend into production was that there was no friction at all."
    Tara NagarSoftware Engineer at Braintrust
  • "The flexibility of Resend is what we value most. It allows us to quickly adapt and refine our email communications as our products evolve."
    Glauber CostaFounder and CEO at Turso
  • "Resend is email with simpler APIs, better webhooks, and best-in-class debugging."
    Dan FarrellyCTO and Co-Founder of Inngest

Start sending in minutes

Resend delivers mission-critical emails for some
of the fastest growing teams.

Sign up for free