-
Notifications
You must be signed in to change notification settings - Fork 3
/
mailer.js
57 lines (51 loc) · 2.01 KB
/
mailer.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var config = require('./config')();
var nodemailer = require('nodemailer');
/*var util = require('util');
var emailTemplate = require('./emailTemplateHandler');
var fs = require('fs');*/
var transporter = nodemailer.createTransport({
service: 'gmail',
auth:{
user: config.mail.userEmail,
pass: config.mail.password
},
secure: false
});
var mailOptions = {
to: config.mail.receiver_email,
from: config.mail.sender_email,
subject: 'Email Confirmation Request',
html: 'This is an auto generated email',
text: 'This the the text of the auto generated email'
};
exports.sendEmail = function(){
return transporter.sendMail(mailOptions, function(err,info){
if(err){
return console.log(err);
}
console.log('Message sent: ' + info.response);
});
};
/*exports.sendRehearsalRequest = function(data) {
var filename = require.resolve('./rehearsalEmailTemplate.html');
var file = fs.readFileSync(filename, 'utf8');
return transporter.sendMail({
to: config.mail.receiver_email,
from: config.mail.sender_email,
subject: 'Disaster Recovery Scheduler Request',
html: 'This is the plain text version'
/!*html: emailTemplate.generateTemplateData({ rehearsal: data.rehearsal,
template: file,
url: config.web.host
})*!/
});
};*/
/*exports.sendRegistrationNotification = function (recipient){
console.log(recipient);
return transporter.sendMail({
to: config.mail.dashboard_admin,
from: '[email protected]',
subject: util.format('%s requested access to Sales Engagement Dashboard (%s)', recipient, process.env.NODE_ENV),
html: util.format('<a href="%s">Login</a> to the dashboard to setup their account', config.web.host)
});
};*/