Email service is using mailgun node client to send emails. We are inspired by mjml project. So, you can use mjml in your project and after compiling templates to simple html files use our project to inject params by handlebars and send emails. Let's dive into the docs.
npm i @paralect/email-service
To create a MailService class you should provide several params to its constructor
const MailService = require('@paralect/email-service');
const mailService = new MailService({
isSendEmail: false, // you can prevent email sending by this param
savedEmailHtmlPath: __dirname, // if you want to save your email as html in development mode
mailgun: { // configs for https://www.npmjs.com/package/mailgun-js
apiKey: 'test',
domain: 'test.info',
},
templatesDir: __dirname, // absolute path to templates directory
});
After that you are able to run send method with several params
const result = await mailService.send(
'email.html',
{ name: 'User name' },
{
from: 'Excited User <[email protected]>',
to: '[email protected]',
subject: 'Test email',
}
);
This project adheres to Semantic Versioning. Every release is documented on the Github Releases page.
Email-service is released under the MIT License.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Thanks goes to these wonderful people (emoji key):
KuhArt 💻 📖 🤔 🎨 |
Evgeny Zhivitsa 💻 📖 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!