@paralect/mail-service-client

0.0.3 • Public • Published

Mail service by Paralect

This client service by Paralect. It 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.

MailService class

To create a MailService class you should provide several params to its constructor

const MailService = require('@paralect/mail-service-client');

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

send(templateName, templateData, data = {})

templateName - the template name which can be built by mail-service-build command (it should contain extension now, for example, report.html)
templateData - template data which will be injected to the template
data - additional email data (subject, email logo and etc.)

That's all folks!

Readme

Keywords

Package Sidebar

Install

npm i @paralect/mail-service-client

Weekly Downloads

0

Version

0.0.3

License

ISC

Last publish

Collaborators

  • fruneen
  • oigen43
  • kuh
  • paralect-andrew
  • igr_krsnk