disposable-email-reader
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Disposable Email Reader

A simple wrapper for some disposable email APIs. At the moment it supports:

Installation

This module uses NPM and can be added to your project running this command

npm install disposable-email-reader --save

How to use it

This is an example of its usage:

//
// Loading library.
var reader = require('disposable-email-reader');
//
// Creating a manager for a specific email.
var myInbox = new reader.HarakiriMail('mytemporaryemail');
//
// Listing all emais.
myInbox.list().subscribe(listResponse => {
  //
  // Walking over each email.
  let list = listResponse.list();
  for (let entryKey in list) {
    let entry = list[entryKey];
    //
    // Retrieving an email.
    myInbox.email(entry.id).subscribe(emailResponse => {
      console.log("\nFrom: %s\nSubject: %s\n", emailResponse.from(), emailResponse.subject());
      console.log("%s\n", emailResponse.body());
    });
  }
});

If you want to use something else instead of HarakiriMail, try one of these:

  • MailDrop:
var myInbox = new reader.MailDrop('mytemporaryemail');
  • Mailinator:
var myInbox = new reader.Mailinator('mytemporaryemail');

Paging

If you want to get only 5 emails, but starting from the third page, you can do something like this:

myInbox.list(10, 5).subscribe(list => {
    // ... my code
});

Note: These options may not be supported by certain services.

Licence

MIT © Alejandro Dario Simi

Readme

Keywords

Package Sidebar

Install

npm i disposable-email-reader

Weekly Downloads

3

Version

0.0.3

License

MIT

Last publish

Collaborators

  • daemonraco