forked from impronunciable/hackdash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmailer.js
More file actions
35 lines (29 loc) · 742 Bytes
/
mailer.js
File metadata and controls
35 lines (29 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Module dependencies
*/
var nodemailer = require('nodemailer');
/**
* Expose config function
*/
var transport;
module.exports = function(app) {
transport = nodemailer.createTransport("SMTP", app.get('config').mailer);
app.on('mail', handleMail);
};
var handleMail = function(data){
switch(data.type) {
case "join":
sendJoinMail(data);
break;
}
};
var sendJoinMail = function(data) {
var mailOptions = {
from: data.from.email,
to: data.to.email,
subject: "[HackDash] " + data.from.email + " joined your project!",
// TODO change this
html: "<h1>HackDash</h1><p>Hi there! "+data.from.name+" Joined your project <strong>"+data.project.title+"</strong>.</p>"
};
transport.sendMail(mailOptions);
};