Features
PreviousNext

Emails

All you need to know to setup your SMTP server.

To be able to send emails to your users, you will need an SMTP server. In this page, we will see how to setup yours.

Setup

You need to have a domain name to set your SMTP server.

The first thing to to is choose which SMTP provider you will use.

Click on one of the available providers to see how to setup the associated env variable :

Set the following environment variables :

EMAIL_FROM="Your Organization Name <sender-address@your-domain.com>"
SUPPORT_EMAIL="support@your-domain.com"

Now go to : @kit/emailer/src/index.ts and uncomment the provider you want to use only.

export { default as EmailProvider } from './nodemailer';
// export { default as EmailProvider } from './postmark';
// export { default as EmailProvider } from './resend';
// export { default as EmailProvider } from './sendgrid';

Supabase

When you deploy your project, you must provide your SMTP server details to Supabase.

The complete process is described in this Supabase documentation page.

But all you need to do is :

Go to your Supabase dashboard.

Go to : Your project > Authentication > Emails.

Click on the SMTP Settings tab.

Enable Enable Custom SMTP and fill the form with your SMTP server details.

Usage

Make sure that the @kit/emailer and @kit/email-templates packages are installed.

pnpm add '@kit/emailer@workspace:*' '@kit/email-templates@workspace:*'

Now you can use the EmailProvider class to send emails.

// import your template import { renderUserDeleteEmail } from '@kit/email-templates'; import { EmailProvider } from '@kit/emailer'; async function sendEmail() { const { html, subject } = await renderUserDeleteEmail({ var1: 'value1', var2: 'value2', // ... }); return EmailProvider.sendEmail({ to: userEmail, // the email address of the recipient from: fromEmail, // the email address of the sender subject, html, }); }

Environment variables

# ============================================
# 📧 EMAIL PROVIDERS
# ============================================
 
# Email sender configuration
EMAIL_FROM="Your Organization Name <sender@your-domain.com>"
SUPPORT_EMAIL="support@your-domain.com"
 
# Alternative providers
EMAIL_NODEMAILER_URL=""
EMAIL_POSTMARK_SERVER_TOKEN=""    # Get from: Postmark > API Tokens
EMAIL_RESEND_API_KEY=""           # Get from: Resend > API Keys
EMAIL_SENDGRID_API_KEY=""         # Get from: SendGrid > Settings > API Keys

How is this guide?

Last updated on 10/17/2025