aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDennis Eriksen <dennis.se@gmail.com>2013-03-26 12:25:54 +0100
committerDennis Eriksen <dennis.se@gmail.com>2013-03-26 12:25:54 +0100
commit6e1ed28eef8125488db3fa0baf46b24ac447a1f6 (patch)
treef47ede15eece39cc3509e6e7032b5c6d16792143
parentadded mail settings (diff)
downloadDivid-6e1ed28eef8125488db3fa0baf46b24ac447a1f6.tar.gz
copied braitsches email dispatcher to have something to work on
https://github.com/braitsch/node-login/blob/master/app/server/modules/email-dispatcher.js
-rw-r--r--modules/email-dispatcher.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/modules/email-dispatcher.js b/modules/email-dispatcher.js
new file mode 100644
index 0000000..3918d0b
--- /dev/null
+++ b/modules/email-dispatcher.js
@@ -0,0 +1,37 @@
+
+var ES = require('./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 = 'http://node-login.braitsch.io/reset-password?e='+o.email+'&p='+o.pass;
+ var html = "<html><body>";
+ html += "Hi "+o.name+",<br><br>";
+ html += "Your username is :: <b>"+o.user+"</b><br><br>";
+ html += "<a href='"+link+"'>Please click here to reset your password</a><br><br>";
+ html += "Cheers,<br>";
+ html += "<a href='http://twitter.com/braitsch'>braitsch</a><br><br>";
+ html += "</body></html>";
+ return [{data:html, alternative:true}];
+} \ No newline at end of file