A simple wrapper for some disposable email APIs. At the moment it supports:
This module uses NPM and can be added to your project running this command
npm install disposable-email-reader --save
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');
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.
MIT © Alejandro Dario Simi