diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-29 22:34:54 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-29 22:34:54 -0400 |
| commit | 01755335859b19756f6d64a2f8a10ae98abceb5f (patch) | |
| tree | d5ba0258769f85fff5512498b04c3c037daecf79 /server/lib/auth/mail.js | |
| parent | 2235c34e498499b8141e835998b962067583a0ce (diff) | |
| parent | 851ddfd46abb7f944c1a6b7f198b5fd8cabd4c13 (diff) | |
merge
Diffstat (limited to 'server/lib/auth/mail.js')
| -rw-r--r-- | server/lib/auth/mail.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/server/lib/auth/mail.js b/server/lib/auth/mail.js index a4abccd..0ba6d5d 100644 --- a/server/lib/auth/mail.js +++ b/server/lib/auth/mail.js @@ -10,7 +10,7 @@ var mail = { templates: {}, init: function(){ - var names = ["welcome","password"].forEach(function(name){ + var names = ["welcome","password","collaborator"].forEach(function(name){ mail.templates[name] = {}; var types = ["text","html"].forEach(function(type){ fs.readFile("views/mail/" + name + "." + type + ".ejs", function(err, data){ @@ -62,6 +62,28 @@ var mail = { mail.send(message, cb) console.log("sent password email to", user.email) }, + + collaborator: function(project, user, collaborator, cb){ + var data = { + projectSlug: project.slug, + projectName: project.name, + nonce: collaborator.nonce, + username: user.username, + } + + var message = { + text: mail.templates.collaborator.text(data), + from: mail.from, + to: collaborator.email, + subject: "Join " + data.username + " on " + data.projectName, + attachment: [ + { data: mail.templates.collaborator.html(data), alternative: true }, + ] + } + mail.send(message, cb) + console.log("sent collaborator email to", collaborator.email) + }, + } module.exports = mail |
