nodebb-plugin-emailer-cloudflare
v0.1.0
Published
Send NodeBB emails through Cloudflare Email Sending REST API. No SMTP required. Includes admin UI, credential verification, test email, safety policies, and rate limiting.
Maintainers
Readme
nodebb-plugin-emailer-cloudflare
Send all NodeBB emails through Cloudflare Email Sending using their REST API -- no SMTP server required.
Drop-in replacement for NodeBB's default email transport. Configure your Cloudflare API token, and every notification, password reset, and digest email is delivered through Cloudflare's infrastructure.
Features
- Zero SMTP configuration -- uses Cloudflare's REST API directly
- Admin panel UI -- guided setup with auto-detect for your Account ID
- Credential verification -- test your API token from the admin panel before going live
- Send test email -- confirm end-to-end delivery right from the settings page
- From address & name overrides -- optionally override NodeBB's default sender identity
- Reply-To support -- set a default reply-to address for all outgoing mail
- CC, BCC, and attachments -- full support for all email features
- Safety policies -- sender allowlist, recipient allowlist/denylist to prevent accidental sends
- Rate limiting -- configurable per-minute and per-day send limits (enforced locally)
- Detailed error reporting -- structured Cloudflare API errors surfaced in NodeBB logs
Requirements
- NodeBB 3.2.x or 4.x
- Node.js 18 or later (uses native
fetch) - A Cloudflare account with Email Sending enabled
- A domain onboarded for Email Sending in your Cloudflare dashboard
- A Cloudflare API token with
Email Sending: Editpermission
Installation
From npm
cd /path/to/nodebb
npm install nodebb-plugin-emailer-cloudflare
./nodebb build
./nodebb restartFrom GitHub
cd /path/to/nodebb/node_modules
git clone https://github.com/jameswross2003/nodebb-plugin-emailer-cloudflare.git
cd .. && ./nodebb build && ./nodebb restartThen activate the plugin in Admin > Extend > Plugins.
Setup
1. Onboard your sending domain
In the Cloudflare dashboard, navigate to Build > Email Service > Email Sending and click + Onboard Domain. Add the domain your forum sends from (e.g. example.com for [email protected]). This must be completed before emails can be sent.
2. Create an API token
Go to Profile > API Tokens and create a custom token with:
| Setting | Value | |---------|-------| | Permissions | Account -- Email Sending -- Edit | | Permissions | Account -- Account Settings -- Read (for auto-detect) | | Account Resources | Include -- your account |
3. Configure the plugin
In NodeBB, go to Admin > Plugins > Emailer (Cloudflare):
- Paste your API token and click Save
- Click Detect next to the Account ID field to auto-fill it, then Save again
- Click Verify Credentials to confirm the token is valid
- Enter your email address and click Send Test to verify delivery
Configuration Options
| Field | Required | Description | |-------|----------|-------------| | API Token | Yes | Cloudflare API token with Email Sending permission | | Account ID | Yes | Your Cloudflare account ID (auto-detected or from dashboard sidebar) | | From Address | No | Override NodeBB's configured sender address | | From Name | No | Override NodeBB's configured sender name | | Reply-To | No | Default reply-to address when NodeBB doesn't provide one |
Safety Policies
Optional safeguards that run locally before any email reaches Cloudflare:
- Allowed From -- Comma-separated domains or addresses. When set, only matching senders can send. Prevents accidental sender spoofing.
- Recipient Allowlist -- Only these domains/addresses can receive mail. Ideal for staging environments.
- Recipient Denylist -- Block specific domains/addresses. Ignored when an allowlist is active.
- Rate Limits -- Per-minute and per-day caps. Set to 0 to disable.
Troubleshooting
| Symptom | Fix | |---------|-----| | "Missing Cloudflare account ID or API token" | Save both fields in the admin panel | | Verify fails with 403 | Regenerate your token with the correct permissions | | Test email fails but verify succeeds | Your domain may not be onboarded -- check Email Sending in Cloudflare | | "Sender not permitted" error | Add your from address/domain to the Allowed From policy field | | Rate limit errors in logs | Increase or disable the per-minute/per-day limits |
Compatibility
This plugin is compatible with NodeBB's plugin system and follows the same patterns as the official emailer plugins (SendGrid, Mailgun, Mandrill). It hooks into static:email.send and transparently replaces the default email transport.
