prodperfect-mailsac

0.0.9 • Public • Published

prodperfect-mailsac

Node library for interacting with Mailsac mail platform

Core features/methods

  • createEmailAddress(customerName: String): create email address

  • getInbox(subjectQuery: String, t): get mails in inbox

  • getMail(mailId: String, deleteMail: Boolean, mode: 'dirty' or 'text'): get content of an mail

  • deleteMail(mailId: String): delete a mail

  • getAll(t, size=20: integer): returns last n-size mails

Quick example

ES6

import MailBox from 'prodperfect-mailsac';

// create an instance of the mailBox
const newMailBox = new MailBox();

// generate a new (random) email address. replace customerName with the name of the customer
const emailAddress = await newMailBox.createEmailAddress('customerName');

// get the first mail matching containing the subjectQuery
const message = await newMailBox.getInbox('welcome to mailsac', t)

// get the content of a specific mail. Using the message object from above
// set deleteMail to true to have the mail deleted immediately
// add mode to specify 'dirty' or 'text'. Default: 'dirty'
const mailContent = await newMailBox.getMail(message._id);

ES5

var MailBox = require('prodperfect-mailsac');

// create a temporary email mailbox
var mailbox = new Mailbox();

// generate a new (random) email address. replace customerName with the name of the customer
mailbox.createEmailAddress('customerName')
  .then(function(addr) {
    console.log('email addr: ', + addr);
  });

// get the first mail matching containing the subjectQuery
mailbox.getInbox('welcome to mailsac', t)
  .then(function(foundEmail) {
    console.log('foundEmail :', foundEmail);
  });

// get the content of a specific mail. Using the message object from above
// set deleteMail to true to have the mail deleted immediately
// add mode to specify 'dirty' or 'text'. Default: 'dirty'
mailbox.getMail(message._id);
  .then(function(fullMessage) {
    console.log('full message :', fullMessage);
  });

Readme

Keywords

none

Package Sidebar

Install

npm i prodperfect-mailsac

Weekly Downloads

26

Version

0.0.9

License

none

Unpacked Size

15.8 kB

Total Files

9

Last publish

Collaborators

  • prodperfectqa