Skip to main content
Many Bolt features rely on email to communicate with users. Common examples include authentication flows such as email verification and password resets, along with application events like order confirmations or product updates. In Bolt, email sending fits closely with your database configuration. Your database manages users and authentication, secrets stored in database settings protect sensitive credentials, and server functions use those secrets to send email through external services. This guide explains how to connect an email service to your Bolt project so your application can send email securely and reliably.

How email works with Bolt databases

When a database is enabled for your project, Bolt unlocks several related features that work together:
  • Authentication handles user sign-up, login, and password reset flows.
  • Secrets store sensitive values like API keys so they are never exposed to client code.
  • Server functions run trusted server-side logic that can send email, call external APIs, and interact with your database.
Email services integrate through server functions, using API keys stored as secrets in your database settings. This setup keeps credentials secure and ensures email logic runs on the server.

Choose an email service

Before setting up email notifications, choose an email provider to deliver your messages. Popular options include:
  • Resend (often used by Bolt by default)
  • Mailgun
  • Postmark
  • SendGrid
Bolt server functions can work with any provider that exposes an HTTP API.
When choosing a service, consider:
  • Email volume: how many messages you expect to send each month
  • Email type: transactional messages, marketing campaigns, or both
  • Setup complexity: how quickly you can create an account and generate an API key

Let Bolt choose your email service

If you ask Bolt to enable email notifications without selecting a provider, Bolt typically uses Resend. It integrates cleanly with Bolt’s infrastructure and requires minimal setup. When Bolt uses Resend, the email infrastructure is prepared automatically. You still need to supply your own Resend API key so emails can be sent on your behalf.

Prerequisites

To send email notifications using a third-party service, your project will need the following things: Using an external email service requires you to setup Secrets, which are stored in your project’s database settings.

Set up email notifications using a third-party service

This section shows how to configure email notifications using Resend, which is commonly used with Bolt. You can choose a different email service if needed. Using a different provider only changes how you create the account and API key in Part 1.
1

Create an API key in Resend

  1. Create an account at https://resend.com/onboarding using email, Google, or GitHub.
  2. Follow Resend’s API key documentation to create a new API key.
  3. Copy the API key and store it securely. You may not be able to view it again later.
The key will look similar to the following: re_CQmFPLaM_siCReVwuKEYvFXMRuSAMPLEz
2

Add the API key to your Bolt project

  1. Open your Bolt project.
  2. Click the database icon at the top center of the screen.
  3. Click Secrets in the left navigation menu.
If Secrets does not appear, your project does not have a database yet.
  1. Create a new secret with the following values:
    • Name: RESEND_API_KEY
      The name is case-sensitive.
    • Value: <insert your resend API key>
  2. Click Create secret.
This allows your server functions to authenticate with Resend and send email.
3

Add your Bolt domain in Resend

After adding your Resend API key to your Bolt project, add your published project domain to Resend.
  1. Log in to your Resend account.
  2. Click Domains in the left menu.
  3. Click Add Domain.
  4. Under Name, enter your primary Bolt domain. For example, mysite.bolt.host
  5. Select your preferred region.
  6. Click Add Domain.
  7. Keep this page open, as you’ll need the information in Part 4.
4

Add your Resend DNS Records in Bolt

The final step in setup is to add the DNS records created by Resend to your Bolt project.
If you are using a custom domain with DNS Records managed by a third-party registrar, you will need to update DNS Records in their dashboard, not in Bolt.
  1. Log in and open any Bolt project.
  2. Click your profile icon in the top right of your screen, then click Settings.
  3. Click Cloud in the left navigation menu.
  4. Scroll down to the Custom domains section and identify the domain you want to update.
  5. Click the three dots on the right side of the domain’s row, then click Open domain settings.
  6. Click Add new record.
  7. Select your record type, then fill in its values based on the information shown in the Resend→Domains page from Step 3.
  8. Click Save.
  9. Create additional Resend records as necessary.
5

Verify your email setup

After completing the steps above, email sending should start working once the domain records finish resolving. This usually takes 10 to 20 minutes, though in some cases it can take a few hours.After giving your DNS records some time to resolve, you can verify the setup by:
  • Triggering an email in your application and confirming it arrives
  • Checking the Resend dashboard for delivery logs or errors

Troubleshooting

If the API key is missing or misconfigured, you may see the following error:

The following secrets are used in the code but don’t exist yet: RESEND_API_KEY
If email is not being delivered, check the following:
  • Confirm the secret name is exactly RESEND_API_KEY
  • Verify the API key value is correct and active
  • Check your email quota with your provider
  • Review your Bolt project logs for server function errors

Mailgun example

The following example shows a server function sending email with Mailgun (as opposed to Resend) using fetch():
const res = await fetch(`https://api.mailgun.net/v3/${MAILGUN_DOMAIN}/messages`, {
  method: "POST",
  headers: {
    Authorization: `Basic ${btoa(`api:${MAILGUN_API_KEY}`)}`,
  },
  body: new URLSearchParams({
    from: "[email protected]",
    to: email,
    subject: "Hello from Mailgun",
    text: "Your notification is working!",
  }),
});