Which mailgun library should be used for migration to Heroku?
I need to migrate the current Parse hosted Cloud code to my Heroku application.
It seems there are a few mailgun libraries for Node.JS, e.g. mailgun and mailgun-js. I am just wondering which is the one the current api.parse.com uses. I will need to migrate my Cloud code and use that library.
An example of the dependencies in package.js and a working example of how to use the library to send a HelloWorld email would be really helpful.
My current Cloud code hosted on api.parse.com looks like:
var Mailgun = require('mailgun');
Mailgun.initialize(MG_DOMAIN, MG_KEY);
You can use any mailgun library out there:
with mailgun:
var Mailgun = require("mailgun");
var mg = new Mailgun('api-key');
with mailgun-js
var api_key = 'key-XXXXXXXXXXXXXXXXXXXXXXX';
var domain = 'mydomain.mailgun.org';
var mailgun = require('mailgun-js')({apiKey: api_key, domain: domain});
Are you able to help offer some working examples of using both of those libs to send emails and handle callback functions to deal with error or sent messages?