ffffng/server/services/mailService.js

21 lines
667 B
JavaScript
Raw Normal View History

2016-05-20 22:11:35 +02:00
'use strict';
angular.module('ffffng')
.service('MailService', function (Database, _) {
return {
enqueue: function (sender, recipient, email, data, callback) {
if (!_.isPlainObject(data)) {
return callback(new Error('Unexpected data: ' + data));
}
Database.run(
'INSERT INTO email_queue (failures, sender, recipient, email, data) VALUES (?, ?, ?, ?, ?)',
[0, sender, recipient, email, JSON.stringify(data)],
function (err, res) {
debugger;
callback(err, res);
}
);
}
};
});