I am having a hard time finding examples of how to send an email with casperjs. This is my attempt so far... - I successfully got an API key from Mailgun. - I found 2 npm modules such as 'mailgun', and 'mailgun-js' - I loaded them and verified mailgun is loaded globablly and locally.. When I run my casper file. $ casperjs casper-test.js I get the following error: 'undefined' is not a constructor (evaluating 'new mailgun')
var Mailgun = require('mailgun').Mailgun;
var mg = new Mailgun('key-xxxxxxxxxxxxxxxa078a515af');
sendText('no-reply@at.com',
['myemail@gmail.com'],
'Testing, casper-test',
{'X-Campaign-Id': 'something'},
function(err) { err && console.log(err) });
My questions are... Am I even going in the right direction? is casperjs capable of firing off one of these modules? If so please let me know how I can fix