Files
wr.do/content/docs/developer/email.mdx
2025-10-16 15:48:04 +08:00

68 lines
3.2 KiB
Plaintext

---
title: Email Configuration
description: How to configure email services in your project
---
<DocsLang en="/docs/developer/email" zh="/docs/developer/email-zh" />
<Callout type="warning" twClass="mt-4">
The configuration of this module underwent significant changes after version v1.1.5. Please update your configuration accordingly:
- Removed `RESEND_API_KEY`, replaced with `BREVO_API_KEY` (earlier versions used Resend service by default. Due to the official account being banned by Resend, we had to switch service providers)
- Changed default email service for system notifications from Resend to Brevo
- `RESEND_FROM_EMAIL` replaced with `EMAIL_FROM`
- New environment variable added: `EMAIL_FROM_NAME`
</Callout>
The WR.DO project's email service module has the capability to receive and send emails. This guide will introduce how to configure the email **sending** service in your project.
> If you need to configure email receiving functionality, please refer to the [cloudflare-email-worker](/docs/developer/cloudflare-email-worker) documentation.
Currently supported email service providers:
- [Resend](https://resend.com) (Free tier: up to 100 emails per day, supports binding 1 domain)
- [Brevo](https://www.brevo.com) (Free tier: up to 300 emails per day, supports binding multiple domains)
Additional email service providers will be integrated based on requirements.
## Environment Variables
```js
BREVO_API_KEY=your-brevo-api-key
EMAIL_FROM=support@your-domain.com
EMAIL_FROM_NAME=WR.DO
```
Register and log in to the Brevo console at [app.brevo.com/settings/keys/api](https://app.brevo.com/settings/keys/api) to create an API key. Copy and paste it into your environment variables.
Note: The `BREVO_API_KEY` configured here is used by default for the `subdomain application notification` feature and is not used for sending emails directly. You can also fill this key in the domain configuration below as the sender for the email service module.
## Brevo
In this project, Brevo is used to send emails in the following scenarios:
- Email service module (`/email`)
- Subdomain application notification (in system settings, this feature is disabled by default)
- Email verification functionality (under development `/dashboard/settings`)
Similarly, create an API key in the Brevo console, then go to the localhost:3000/admin/system page in your system. In the **Domain Management** section, click **Add Domain**, and fill in the corresponding API key in the **Email Service Provider** field and save:
![](/_static/docs/domain-form-email.png)
After that, you can bind your domain on the [Domain](https://app.brevo.com/senders/domain/list) page in the Brevo console. Follow the prompts to add DNS records to complete the configuration:
![](/_static/docs/brevo-domain.png)
Finally, add the domain in this system sequentially. The completed configuration will look like this:
![](/_static/docs/domain-list.png)
## Resend
In this project, Resend is only used for sending emails through the email service module.
#### Creating an API Key
After logging in to Resend, it will prompt you to create your first API key.
Copy and paste it. The subsequent steps are similar to Brevo - you need to bind your domain first and configure DNS records.