mailosaur / mailosaur-node

Mailosaur email and SMS testing library for Node.js

Home Page:https://mailosaur.com/docs/languages/nodejs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type Error when initializing Mailbox

whitef0x0 opened this issue · comments

commented

Hey.

So I'm getting a type error after just copy pasting from your example code at the initialization of my mailbox. I've checked my mailbox code and it is indeed correct (I can query it through curl).

My Error
var mailbox = new Mailosaur.MailBox('mailbox_code');
^
TypeError: undefined is not a function
at Object. (/path/to/app/app.js:2:15)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3

My app code
var Mailosaur = require('mailosaur')('api_code');
var mailbox = new Mailosaur.MailBox('mailbox_code');

mailbox.getEmails('email@example.com', function(err){
if(err) throw(err);
email.forEach(function(email){
console.log(email.text);
});
});

Thanks for trying it out, but it looks like you made a small change to what you copy pasted. :)
It's new Mailosaur.Mailbox vs Mailosaur.MailBox