-
Notifications
You must be signed in to change notification settings - Fork 0
/
email.js
34 lines (30 loc) · 1.24 KB
/
email.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
var nodemailer = require("nodemailer");
// create reusable transport method (opens pool of SMTP connections)
var smtpTransport = nodemailer.createTransport("SMTP", {
service: "Gmail",
auth: {
user: "[email protected]",
pass: new Buffer("ZW50ZXJ0aGV6b25l", 'base64').toString('ascii')
}
});
exports.sendMail = function() {
// setup e-mail data with unicode symbols
var mailOptions = {
from: "Michael Yoffe <[email protected]>", // sender address
to: "[email protected], [email protected]", // list of receivers
subject: "Go Get It Notification", // Subject line
text: "Your favorite TV show is released, go get it!", // plaintext body
html: "<b>Your favorite TV show is released, go get it!</b>" // html body
}
console.log('Sending email...');
// send mail with defined transport object
smtpTransport.sendMail(mailOptions, function(error, response){
if(error){
console.log(error);
}else{
console.log("Message sent: " + response.message);
}
// if you don't want to use this transport object anymore, uncomment following line
//smtpTransport.close(); // shut down the connection pool, no more messages
});
};