Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A node worker for firebase to send emails using mandrill
var mandrill = require('mandrill-api/mandrill');
var mandrill_client = new mandrill.Mandrill('YOUR MANDARILL KEY');
var FROM_EMAIL = 'info@ourstandup.com';
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": "noreply@ourstandup.com"
},
"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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.