
By mohammadGh
Email-provider for Strapi CMS supports sending localization (i18n) email-templates using any email provider like Mailgun, Sendgrid, Mailjet, Azure-email, Resend and your customized email provider.
released August 4, 2025
npm install strapi-provider-email-extrastrapi-email-provider-extra is a email provider for the Strapi CMS that acts as a wrapper for various popular email providers such as
MailGun,
SendGrid,
Mailjet,
Azure Email,
Resend,
Nodemailer or etc. This plugin adds the functionality to send localized email templates based on the current or user-requested locale, enhancing the internationalization capabilities of your Strapi application.
Install the Plugin:
npm install strapi-email-provider-extraConfigure the Plugin:
Add the configuration to your config/plugins.js file:
module.exports = ({ env }) => ({
email: {
config: {
provider: 'strapi-provider-email-extra',
providerOptions: {
defaultProvider: 'nodemailer', // or 'mailgun', 'mailjet', etc.
providers: {
nodemailer: {
provider: 'nodemailer',
providerOptions: {
host: 'smtp.ethereal.email',
port: 587,
secure: false,
auth: {
user: 'claire.daugherty82@ethereal.email',
pass: 'w6nhfjaAnKd7Asczzv',
}
}
}
},
// default template options
dynamicTemplates: {
enabled: true,
collection: 'api::email-template.email-template',
subjectMatcherField: 'subjectMatcher',
testEmailSubjectToMatch: 'Strapi test mail',
forgotPasswordUrl: '/api/auth/forgot-password',
sendEmailConfirmationUrl: '/api/auth/send-email-confirmation',
registerUrl: '/api/auth/local/register',
vars: {
// additional variables to be used in dynamic templates interpolation
}
}
},
// email settings
settings: {
defaultFrom: 'info@mycompany.co',
defaultFromName: 'My Company'
},
}
}
})create a collection content in Content-Type Builder to localize your email template:
Now, create a collection named EmailTemplate which api id: email-template. check internationalization checkbox in advance-setting tab when creating this collection.
The EmailTemplate collection should contains this fields:
subjectMatcher as textsubject as text for your email subjectfrom as email (used in the from section of email)text as rich-text for your email bodyhtml as rich-text for your email body as htmlAdd your email templates for "Account Confirmation" or "Reset-password" or any subject with your prefer locales :
Now, add email templates with any locale you want to EmailTemplate with subjectMatcher for different categories:
subjectMatcher: 'Account Confirmation': for emails that the system will send when new user created to confirm account.subjectMatcher: 'Reset Password': for emails that the system will send when user forget the password.subjectMatcher: 'Strapi test mail':for test emails that you can send them through Strapi Admin UI.Now, when new user registered or forgot-password, the email content automatically fetched from your localized test templates with proper locale. the proper locale is chosen from default locale of strapi (can set in Strapi Admin UI), or from request's query option.
For example, to send a France email template in user registration api, call the register api like this with locale=fr in query params:
fetch('http://localhost:1337/api/auth/local/register?locale=fr', {
method: 'POST',
body: {
username: 'my-user',
email: 'user-email@gmail.com',
pass: '123456'
}
})
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.error(error))To send localized emails in your Strapi application, you can call the send method provided by the email's plugin.
const emailService = strapi.plugins.email.services.email
const emailOptions = {
to: 'user@example.com',
subject: 'Welcome to Our Service', // the subject must exist in your test-template collection in `subjectMatcher` field.
locale: 'fr', // Optional, defaults to configured default locale of strapi or will be fetched from user's request query.
}
await emailService.send(emailOptions)We welcome contributions to improve this project. To contribute, please fork the repository and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
This project was inspired by the need for flexible and localized email sending capabilities within the Strapi CMS ecosystem.
With Strapi Email Provider Extra, you can now send personalized, localized emails with ease, leveraging your preferred email provider. Enjoy streamlined communication with your international user base!
For any issues or feature requests, please open an issue on our Issues.
Share your work with the community and get it listed in the Strapi ecosystem for everyone to discover and use.
Submit
