-
-
Save eusthace811/a4d45b9c8f3cc1bb96d0127f4cea7cab to your computer and use it in GitHub Desktop.
Revisions
-
eibrahim created this gist
Jul 22, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ var mandrill = require('mandrill-api/mandrill'); var mandrill_client = new mandrill.Mandrill('YOUR MANDARILL KEY'); var FROM_EMAIL = '[email protected]'; var FROM_NAME = 'Our Standup'; var db = require('./database'); var invitationsRef = db.ref("invitations"); var teamsRef = db.ref("teams"); var usersRef = db.ref("users"); var manager = { send: function(to, name, subject, body){ var message = { "html": "<p>"+ body + "</p>", "subject": subject, "from_email": FROM_EMAIL, "from_name": FROM_NAME, "to": [{ "email": to, "name": name || to, "type": "to" }], "headers": { "Reply-To": "[email protected]" }, "auto_text": true, "merge": true, "merge_language": "handlebars", "metadata": { "website": "www.ourstandup.com" }, }; var async = true; mandrill_client.messages.send({"message": message, "async": async }, function(result) { }, function(e) { console.log('A mandrill error occurred: ' + e.name + ' - ' + e.message); }); } } module.exports = manager;