strapi-plugin-email-bulk-sender
v0.1.0
Published
A Strapi plugin that allows sending bulk email campaigns using HTML templates.
Readme
Email Bulk Sender Plugin
A Strapi plugin that allows sending bulk email campaigns using HTML templates.
Description
Email Bulk Sender is a Strapi v5 plugin that provides functionality for mass sending personalized email messages. The plugin includes:
- Administrative interface for selecting recipients and templates
- Template system with variable support
- Bulk sending with result tracking
- Security with template path validation
Features
- 📧 Bulk email sending with rate limiting
- 🎨 HTML template support with variables
- 👥 Recipient selection from various collections
- 📊 Send result tracking
- 🔒 Secure template file handling and authentication
- 🎯 Message personalization
- ✅ Email validation
- ⚡ Configurable rate limiting
Installation
- Ensure the plugin is located in the
src/plugins/strapi-plugin-email-bulk-sender/folder - The plugin is automatically loaded by Strapi on startup
Configuration
Plugin Configuration
Add configuration to the config/plugins.ts file:
export default {
// ... other plugins
'strapi-plugin-email-bulk-sender': {
enabled: true,
resolve: './src/plugins/strapi-plugin-email-bulk-sender'
},
// ... other settings
}Email Service Configuration
Ensure that an email provider is configured in Strapi. Add configuration to config/plugins.ts:
export default {
// ... other plugins
email: {
config: {
provider: 'nodemailer', // or another provider
providerOptions: {
// provider settings
},
settings: {
defaultFrom: '[email protected]',
defaultReplyTo: '[email protected]',
},
},
},
// ... other settings
}Template Path Configuration
By default, the plugin looks for templates in the templates/ folder in the project root. You can customize various settings:
export default {
// ... other plugins
'strapi-plugin-email-bulk-sender': {
enabled: true,
resolve: './src/plugins/strapi-plugin-email-bulk-sender',
config: {
emailTemplate: {
enabled: true,
path: 'templates', // path to templates folder
rateLimitDelay: 2000 // delay between emails in milliseconds (default: 1000)
}
}
},
// ... other settings
}Configuration Options
enabled: Enable/disable the email template functionality (default: true)path: Path to the templates folder relative to project root (default: 'templates')rateLimitDelay: Delay between email sends in milliseconds to prevent SMTP rate limiting (default: 1000)
Usage
Creating Templates
- Create HTML files in the
templates/folder - Use variables in the format
{{variableName}} - Available variables:
{{email}}- recipient's email{{name}}- recipient's name- Any additional fields from your document data (e.g.,
{{company}},{{position}}, etc.)
Example template (templates/welcome.html):
<!DOCTYPE html>
<html>
<head>
<title>Welcome</title>
</head>
<body>
<h1>Hello {{name}}!</h1>
<p>Your email: {{email}}</p>
<p>Welcome to our platform!</p>
</body>
</html>Sending via Administrative Interface
- Go to the Strapi admin panel
- Open the list of users in Content Manager
- Select recipients from available users using checkboxes
- The “Send email” button will appear. Click it.
- Choose a template for sending
- Click "Send emails"
API Endpoints
Get Templates List
GET /api/strapi-plugin-email-bulk-sender/templatesGet Template Content
GET /api/strapi-plugin-email-bulk-sender/templates/:templatePathSend Bulk Emails
POST /api/strapi-plugin-email-bulk-sender/send-bulk-emailsRequest body:
{
"template": "welcome",
"documents": [
{
"id": 1,
"email": "[email protected]",
"name": "John Doe"
}
]
}Security Features
The plugin includes several security measures:
- Authentication Required: All email sending endpoints require admin authentication
- Email Validation: All email addresses are validated before sending
- Template Path Security: Template paths are validated to prevent directory traversal attacks
- Rate Limiting: Configurable delays between emails to prevent SMTP abuse
- Input Validation: Comprehensive validation of all input parameters
Project Structure
src/plugins/strapi-plugin-email-bulk-sender/
├── admin/ # Administrative interface
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Admin pages
│ │ └── utils/ # Utilities
├── server/ # Server-side
│ ├── src/
│ │ ├── controllers/ # API controllers
│ │ ├── routes/ # Routes
│ │ ├── services/ # Services
│ │ └── config/ # Configuration
├── package.json
└── README.mdDevelopment
Building the Plugin
npm run buildDevelopment Mode
npm run watchTypeScript Check
npm run test:ts:front # for admin
npm run test:ts:back # for serverRequirements
- Strapi v5.23.3
- Node.js 18+
- Configured email provider in Strapi
License
MIT License
Author
denisgrushkin [email protected]
