@trycake/ms-email-service

3.0.1 • Public • Published

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
  });

Readme

Keywords

none

Package Sidebar

Install

npm i @trycake/ms-email-service

Weekly Downloads

0

Version

3.0.1

License

ISC

Unpacked Size

23.4 kB

Total Files

12

Last publish

Collaborators

  • tylersteiman
  • kbudd
  • pasann
  • andylavor
  • vinodharanie.cake
  • hashan1100
  • madcrumley
  • manojmadushanka
  • sinethj
  • buddhika_mm
  • dushyantha_rubasinghe
  • pavini_weerasinghe
  • dinesh-de-silva
  • mujahid.cake
  • cakecloudadmin
  • nishenp
  • jeewantha.cake
  • hashanm
  • hasithag
  • janithmid