Giter Club home page Giter Club logo

node-mailinator's Introduction

node-mailinator

node mailinator api.

Example

var mailinator = require('mailinator')({token: 'token-here'});

mailinator.getMessages('georgebush', function (err, messages) {
  console.log(messages);
  mailinator.readMessage(messages[0].id, function (err, res) {
    console.log(res);
  });
});

API

var mailinator = require('mailinator')(opts);

opts

An object of options:

  • opts.token is a token string from mailinator. Required.
  • opts.apiUrl is the base url for the api. Defaults to "https://api.mailinator.com/api/".
  • opts.to is the local part of an email address that mail was sent to. E.g. "obscure" would aquire the mail sent to [email protected]

mailinator.getMessages(to, cb)

  • to is the local part of an email address that mail was sent to. If null, the default is opts.to.
  • cb(err, messages)
// whatever@mailinator.com
mailinator.getMessages("whatever", function (err, data) {
  console.dir(data); // => [{ id: '1420049469-71065803-whatever', ... }, ...]
})

mailinator.readMessage(msgId, cb)

  • msgId is the id of the desired message. E.g. "1420049469-71065803-whatever"
  • cb(err, message)
// whatever@mailinator.com
mailinator.readMessage("1420049469-71065803-whatever", function (err, data) {
  console.dir(data); // => { apiInboxFetchesLeft:697, apiEmailFetchesLeft: 10, ... }
})

License

ISC

node-mailinator's People

Contributors

artskydj avatar dweinstein avatar knoxcard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

node-mailinator's Issues

getLatestEmail throws json parse error

i get this error

Unexpected "!" at position 1 in state START

  at Parser.proto.charError (../node_modules/jsonparse/jsonparse.js:84:16)
  at Parser.proto.write (../node_modules/jsonparse/jsonparse.js:112:23)
  at Stream.<anonymous> (../node_modules/JSONStream/index.js:21:12)
  at Stream.stream.write (../node_modules/through/index.js:26:11)
  at drain (../node_modules/through/index.js:36:16)
  at Stream.stream.queue.stream.push (../node_modules/through/index.js:45:5)
  at emit (../node_modules/split/index.js:36:14)
  at next (../node_modules/split/index.js:48:7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.