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.
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.
- 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:- A Bolt database created
- Your project published
- A custom domain attached to your project
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.Create an API key in Resend
- Create an account at https://resend.com/onboarding using email, Google, or GitHub.
- Follow Resend’s API key documentation to create a new API key.
- 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_siCReVwuKEYvFXMRuSAMPLEzAdd the API key to your Bolt project
- Open your Bolt project.
- Click the database icon at the top center of the screen.
- Click Secrets in the left navigation menu.
- Create a new secret with the following values:
- Name:
RESEND_API_KEY
The name is case-sensitive. - Value:
<insert your resend API key>
- Name:
- Click Create secret.
This allows your server functions to authenticate with Resend and send email.
Add your Bolt domain in Resend
After adding your Resend API key to your Bolt project, add your published project domain to Resend.
- Log in to your Resend account.
- Click Domains in the left menu.
- Click Add Domain.
- Under Name, enter your primary Bolt domain. For example,
mysite.bolt.host - Select your preferred region.
- Click Add Domain.
- Keep this page open, as you’ll need the information in Part 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.
- Log in and open any Bolt project.
- Click your profile icon in the top right of your screen, then click Settings.
- Click Cloud in the left navigation menu.
- Scroll down to the Custom domains section and identify the domain you want to update.
- Click the three dots on the right side of the domain’s row, then click Open domain settings.
- Click Add new record.
- Select your record type, then fill in its values based on the information shown in the Resend→Domains page from Step 3.
- Click Save.
- Create additional Resend records as necessary.
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