@trycake/ms-email-service

Email service implemented to notify MS actions

Stats

StarsIssuesVersionUpdatedCreatedSize
@trycake/ms-email-service
2.0.14 years ago4 years agoMinified + gzip package size for @trycake/ms-email-service in KB

Readme

Micro services email API

How to deploy?

Clone the project
Install dependencies
npm install
Check eslint
npm run eslint
Run test cases
npm run test
Build the project
npm run build
Copy the package.json and README to build
cp package.json README.md build/
Deploy the package to leapset repo (make sure update the version)
npm publish

How to use?

Add as a dependency in package.json
"@trycake/ms-email-service": "<version>"
Install dependencies
npm install
Import to utilize the functionalities
import { EmailService } from '@trycake/ms-email-service';
Email service will expose configure() and sendMail() to use in MSs
Configure email service
Provide email configs as a input to configure()
emailConfigs = {
    url: http://xxx-email.leapset.com/api/xml, //Required
    from: abc@syscoLabs.com, //Required
    toAddreses: [cde@syscoLabs.com], //Required
    bccAddreses: [efg@syscoLabs.com], //Optional
  }
Send email alert
Provide email data as a input to sendMail()
emailData = {
    subject: 'Test', //Required
    message: 'Message from The Sysco Labs Team.', //Required
    attachmentName: 'attachment.pdf', //Optional
    attachmentData: '<base64 encoded file data>', //Optional
    url: http://xxx-email.leapset.com/api/xml, //Optional
    from: abc@syscoLabs.com, //Optional
    toAddreses: [cde@syscoLabs.com], //Optional
    bccAddreses: [efg@syscoLabs.com], //Optional
  }
Handle success and errors
Handle success and error accordingly
  sendMail(emailData).then((response) => {
    // Succeed
  }).catch((e) => {
    // Error
  });

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.