/** * * User: Martin Donnelly * Date: 2016-04-08 * Time: 16:35 * */ var jade = require('pug'), UltraSES = require('ultrases'), dateFormat = require('dateformat'); var logger = require('log4js').getLogger('mailer'); var mailer = new UltraSES({ aws: { accessKeyId: 'AKIAJWJS75F7WNCGK64A', secretAccessKey: '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', region: 'eu-west-1' }, defaults: { from: 'Martin Donnelly ' } }); module.exports = { sendEmailV1: function(todayCache, newpath) { var now = new Date(); var email = { to: 'martind2000@gmail.com', subject: 'Today - ' + dateFormat(now, 'dddd, mmmm dS, yyyy') }; var template = { file: newpath + '/' + 'jade/today.jade', locals: todayCache }; mailer.sendTemplate(email, template, function(err) { if (err) throw err; logger.info('compiled template email sent'); }); } };