Skip to content

CVBDL/ra-notification-nodejs-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ra Notification NodeJS Client

Prerequisites

  • NodeJS v6.0.0+

Basic Usage

const raNotificationClient = require('ra-notification-nodejs-client');

const mail = {
  From: "[email protected]",
  To: ["[email protected]"],
  Cc: [],
  Bcc: [],
  Subject: "RaNotification Released!",
  Body: "Hi all, we're pleased to announce that RaNotification is released.",
  IsHtml:  false
};

// send basic email
raNotificationClient
  .sendEmail(mail)
  .then(() => {
    console.log('Success');
  })
  .catch(err => {
    console.log('Failure: ', err);
  });

Send HTML formatted email

const raNotificationClient = require('ra-notification-nodejs-client');

const mail = {
  From: "[email protected]",
  To: ["[email protected]"],
  Cc: [],
  Bcc: [],
  Subject: "RaNotification Released!"
};

raNotificationClient
  .sendHtmlEmail(mail, 'C:\\email-template.html')
  .then(() => {
    console.log('Success');
  })
  .catch(err => {
    console.log('Failure: ', err);
  });

email-template.html

<ul>
  <li>Hello</li>
  <li>World</li>
</ul>

Email with attachments

const raNotificationClient = require('ra-notification-nodejs-client');

const mail = {
  From: "[email protected]",
  To: ["[email protected]"],
  Cc: [],
  Bcc: [],
  Subject: "RaNotification Released!",
  Body: "Hi all, we're pleased to announce that RaNotification is released.",
  IsHtml:  false
};

// send basic email
raNotificationClient
  .addAttachment('a.txt', 'C:\\a.txt')
  .addAttachment('note.txt', 'C:\\b.txt')
  .sendEmail(mail)
  .then(() => {
    console.log('Success');
  })
  .catch(err => {
    console.log('Failure: ', err);
  });

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published