Skip to content

A simple wrapper for some disposable email APIs.

License

Notifications You must be signed in to change notification settings

daemonraco/disposable-email-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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