@ayhid/strapi-provider-email-brevo
v3.0.0
Published
Brevo (Sendinblue) email plugin for Strapi v5 with admin panel configuration
Maintainers
Readme
@ayhid/strapi-provider-email-brevo
Brevo (formerly Sendinblue) email plugin for Strapi v5 with admin panel configuration.
Features
- Admin Panel Settings - Configure email settings directly from the Strapi admin
- Strapi v5 compatible - Built for the latest Strapi version
- Uses Brevo API - Direct API calls (not SMTP) for faster, more reliable delivery
- Test Email - Send test emails from the admin panel to verify configuration
- Development fallback - Logs emails to console when disabled or no API key is configured
- Full email support - HTML, plain text, CC, BCC, reply-to
- TypeScript - Fully typed codebase
Installation
npm install @ayhid/strapi-provider-email-brevoConfiguration
Option 1: Admin Panel (Recommended)
After installation, navigate to Settings > Brevo Email in your Strapi admin panel to configure:
- Enable/Disable - Toggle email sending on/off
- API Key - Your Brevo API key
- Default From Email - Default sender email address
- Default From Name - Default sender name
- Default Reply-To - Default reply-to address
You can also send a test email to verify your configuration works correctly.
Option 2: Environment Variables
You can also configure the plugin via environment variables. Add to your .env:
BREVO_API_KEY=xkeysib-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[email protected]
BREVO_SENDER_NAME=Your App NameThen configure in config/plugins.ts:
export default ({ env }) => ({
'email-brevo': {
enabled: true,
config: {
apiKey: env('BREVO_API_KEY'),
defaultFrom: env('BREVO_SENDER_EMAIL', '[email protected]'),
defaultFromName: env('BREVO_SENDER_NAME', 'My App'),
defaultReplyTo: env('BREVO_SENDER_EMAIL'),
},
},
});Note: Settings configured in the admin panel take precedence over environment variables.
Usage
Sending Emails
Use Strapi's email service:
await strapi.plugins['email-brevo'].services.email.send({
to: '[email protected]',
subject: 'Hello from Strapi!',
text: 'This is a plain text email.',
html: '<h1>Hello!</h1><p>This is an HTML email.</p>',
});With CC and BCC
await strapi.plugins['email-brevo'].services.email.send({
to: '[email protected]',
cc: ['[email protected]', '[email protected]'],
bcc: '[email protected]',
subject: 'Team Update',
html: '<p>Important update for the team.</p>',
});Custom Sender
await strapi.plugins['email-brevo'].services.email.send({
from: '[email protected]',
fromName: 'Custom Sender',
to: '[email protected]',
replyTo: '[email protected]',
subject: 'Custom sender example',
text: 'This email has a custom sender.',
});Admin Panel
The plugin adds a settings page under Settings > Brevo Email where you can:
- Enable/Disable the plugin - When disabled, emails are logged to console
- Configure API Key - Your Brevo transactional email API key
- Set Default Sender - Email and name for outgoing emails
- Set Reply-To - Default reply-to address
- Send Test Email - Verify your configuration works
Development Mode
When the plugin is disabled or no API key is configured, emails are logged to the console:
[Brevo Email] Plugin disabled - logging email to console
================================================================================
From: [email protected] (My App)
To: [email protected]
Subject: Test Email
--------------------------------------------------------------------------------
Text: This is the email content...
================================================================================This is perfect for local development without needing a Brevo account.
Getting a Brevo API Key
- Sign up or log in at Brevo
- Navigate to Settings > SMTP & API
- Click "Generate a new API key"
- Copy the key (starts with
xkeysib-...) - Add it in the admin panel or your
.envfile
Why Brevo API vs SMTP?
This plugin uses Brevo's Transactional Email API instead of SMTP:
- Faster - Direct API calls vs SMTP handshakes
- More reliable - No connection timeouts or limits
- Better feedback - Detailed error responses
- Feature-rich - Access to tracking, scheduling, attachments
Requirements
- Strapi v5.x
- Node.js >= 20
- Brevo account (free tier available)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes using Conventional Commits
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Changelog
See CHANGELOG.md for release history.
License
Links
Made with love for the Strapi community
