-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemails.js
36 lines (33 loc) · 882 Bytes
/
emails.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
var credentials = {
gmail: {
user: process.env.GMAIL__USER,
password: process.env.GMAIL__PASSWORD
}
};
var nodemailer = require('nodemailer');
exports.sendMatchEmail = function(p1,p2){
var transport = nodemailer.createTransport("SMTP",{
service: "Gmail",
auth: {
user: credentials.gmail.user,
pass: credentials.gmail.password
}
});
console.log(p1);
console.log(p2);
var mailOptions = {
from: "RPS Hackathon ✔ <" + credentials.gmail.user + ">",
bcc: [p1.email, p2.email],
subject: p1.name + " vs. " + p2.name,
text: "ROUND 1: FIGHT!"
}
console.log("Sending REAL email to " + mailOptions.bcc);
transport.sendMail(mailOptions, function(error, response){
if(error){
console.log(error);
}else{
console.log("Message sent: " + response.message);
}
transport.close();
});
}