var ES = require('../config/email-settings'); var EM = {}; module.exports = EM; EM.server = require("emailjs/email").server.connect({ host : ES.host, user : ES.user, password : ES.password, ssl : true }); EM.dispatchResetPasswordLink = function(account, callback) { EM.server.send({ from : ES.sender, to : account.email, subject : 'Password Reset', text : 'something went wrong... :(', attachment : EM.composeEmail(account) }, callback ); } EM.composeEmail = function(o) { var link = 'https://divid.no/reset-password?e='+o.email+'&p='+o.pass; var html = ""; html += "Hi "+o.name+",

"; html += "Your username is :: "+o.user+"

"; html += "Please click here to reset your password

"; html += "Cheers
"; html += ""; return [{data:html, alternative:true}]; }