These integration guides are not official documentation and the Strapi Support Team will not provide assistance with them.
Introduction to Sendinblue and Strapi
Sendinblue is an email marketing and transactional email service offering tools for email campaigns, automation, and sending transactional emails. With features like templates and contact management, it helps improve email communication.
By integrating Sendinblue with Strapi, you can manage your content and email services from a single application, streamlining processes like sending confirmation emails, newsletters, and automated messages directly from your Strapi backend.
Why Use Strapi with Sendinblue
Achieve Reliable Email Delivery
Sendinblue is a popular choice for email services and can be used as an alternative to Strapi's default email provider.
Benefit from a Generous Free Tier
Sendinblue's free plan lets you send up to 300 emails per day, which is beneficial for starting out or moderate email needs.
Ensure Seamless Integration
Sendinblue works well with Strapi, even when using Docker Compose with Strapi or scaling Strapi applications in Docker containers, ensuring consistent email functionality across environments.
Enhance Email Marketing with Advanced Features
Manage email marketing campaigns directly from Strapi, leveraging the latest Strapi updates. Features like contact lists, automation workflows, and templates help you engage your audience effectively. Additionally, adopting an API-first approach in Strapi facilitates seamless integration with Sendinblue. Strapi's multilingual capabilities also enable you to tailor your email communications to a global audience.
Implement Automated Workflows
Automate transactional emails like registration confirmations and password resets, saving time and ensuring timely communication.
Boost User Engagement
Synchronizing user data between Strapi and Sendinblue enables personalized email interactions, enhancing user engagement.
Key Features of Sendinblue
Send Transactional Emails
Send transactional emails directly from Strapi, essential for registration confirmations, password resets, and other automated emails.
Manage Email Marketing Campaigns
Manage and automate email marketing campaigns, including newsletters and promotional emails, and improve onboarding with Strapi using automation workflows for targeted marketing.
Utilize SMTP Relay and API Integration
Sendinblue offers SMTP relay and API access. Integrate with Strapi using plugins or directly call the API for greater control over email processes.
Use Email Templates
Utilize Sendinblue's email templates for consistent and professional designs, easily integrated into Strapi to standardize communications.
Manage Contacts
Add or update contacts while sending emails, keeping lists updated and allowing personalized messaging based on contact attributes.
Streamline Processes with Automation Workflows
Use automation workflows to streamline email marketing strategies, triggering emails based on user actions or predefined conditions.
Enhance Email Deliverability
Sendinblue enhances email deliverability compared to default providers, avoiding blocking by major servers like Gmail, Outlook, and Yahoo.
Best Practices for Integrating Sendinblue With Strapi
Store API Keys in Environment Variables
Secure your Sendinblue credentials by using environment variables, allowing easy configuration across environments.
Implement Comprehensive Error Handling
Handle errors gracefully with try-catch blocks to manage exceptions and logging for diagnosing issues, maintaining reliable communication.
Use Sendinblue Email Templates
Use Sendinblue's templating system for consistent designs, managing content directly from Sendinblue without changing application code.
Use Advanced Features
Integrate Sendinblue's contact management, segmentation, and automation workflows to enhance marketing strategies and personalize user experiences. Additionally, consider adding external databases in Strapi to store and manage extensive contact information or campaign data.
Secure Your Email Endpoints
Ensure email endpoints are secured with authentication and rate limiting to prevent unauthorized use and potential abuse.
Test Thoroughly Before Deployment
Before deploying Strapi on Vercel or deploying Strapi on AWS, test your integration in a development environment to identify and resolve issues, ensuring emails are sent correctly and all features function as expected.
Getting Started With Sendinblue
Integrating Sendinblue with Strapi enables you to send emails directly from your application.
Install the Sendinblue Email Provider
First, install the Sendinblue email provider for Strapi by checking the correct package name in the Strapi Marketplace or official sources, and use the typical npm command format:
1npm install @strapi/provider-email-\[provider-name\] --save
Update your package.json to include the following dependency for installing from GitHub:
1"dependencies": {
2
3 "strapi-provider-email-sendinblue": "github:yanotoma/strapi-provider-email-sendinblue#<version>"
4
5}
Replace
Configure the Email Plugin
Create or update the config/plugins.js file in your Strapi project with the following setup for the Sendinblue email provider:
1module.exports = ({ env }) => ({
2
3 email: {
4
5 provider: 'sendinblue',
6
7 providerOptions: {
8
9 apiKey: env('SENDINBLUE_API_KEY'),
10
11 },
12
13 settings: {
14
15 defaultFrom: '[youremail@example.com](mailto:youremail@example.com)',
16
17 defaultFromName: 'Your Name',
18
19 defaultReplyTo: '[youremail@example.com](mailto:youremail@example.com)',
20
21 },
22
23 },
24
25});
To set your Sendinblue API key, consult the official documentation for the correct variable name and usage in the .env file.
Send Emails with Strapi
After configuring the provider, you can send emails using Strapi's email service.
Send a Basic Email
1await strapi.plugins\['email'\].[services.email](http://services.email).send({
2
3 to: '[recipient@example.com](mailto:recipient@example.com)',
4
5 subject: 'Welcome!',
6
7 html: '<h1>Hello!</h1><p>Thanks for joining us.</p>',
8
9 text: 'Hello! Thanks for joining us.',
10
11 tags: \['welcome', 'new-user'\],
12
13});
Use Sendinblue Templates
To use templates in Sendinblue with Strapi's email plugin, consider general methods for sending emails with templates. Consult the documentation for guidance on using Lodash for handling templates, as specific instructions for Sendinblue templates and parameters are not detailed.
Manage Contacts
Add or update contacts in Sendinblue lists while sending emails:
1const contact = {
2
3 email: '[newuser@example.com](mailto:newuser@example.com)',
4
5 attributes: {
6
7 FIRSTNAME: 'New',
8
9 LASTNAME: 'User',
10
11 },
12
13};
14
15await strapi.plugins\['email'\].[services.email](http://services.email).send({
16
17 to: [contact.email](http://contact.email),
18
19 subject: 'Welcome!',
20
21 html: \`<h1>Hello ${contact.attributes.FIRSTNAME}</h1>\`,
22
23 text: \`Hello ${contact.attributes.FIRSTNAME}\`,
24
25 tags: \['welcome'\],
26
27 contact, // Intended to add or update the contact in Sendinblue
28
29});
Use Nodemailer with Sendinblue SMTP: An Alternative Method
To use Sendinblue's SMTP with the Nodemailer provider in Strapi, you can install the Nodemailer provider, configure it in config/plugins.js, and set up the necessary environment variables.
Create Custom Email Routes
To manage specific email actions like newsletter subscriptions, consider setting up custom routes. Start by defining a new route in api/contact/config/routes.json. Then, create the corresponding controller in api/contact/controllers/Contact.js. If needed, install the Sendinblue SDK with npm install sib-api-v3-sdk and include your Sendinblue API key in the .env file.
To make a route publicly accessible in Strapi, adjust the route's auth configuration parameter to false, allowing access without using Strapi's authentication system.
Tips for a Smooth Integration
- Use Environment Variables: Keep sensitive data like API keys in environment variables to enhance security.
- Test Thoroughly Before Deployment: Before deploying Strapi on Vercel or deploying Strapi on AWS, test your integration in a development environment to identify and resolve issues, ensuring emails are sent correctly and all features function as expected.
- Handle Errors Gracefully: Implement error handling to manage failed email sends and provide feedback.