parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Which mailgun library should be used for migration to Heroku?

Open grassland-curing-cfa opened this issue 10 years ago • 2 comments

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);

grassland-curing-cfa avatar Mar 01 '16 03:03 grassland-curing-cfa

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});

flovilmart avatar Mar 01 '16 16:03 flovilmart

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?

grassland-curing-cfa avatar Mar 01 '16 23:03 grassland-curing-cfa