-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmailSender.js
36 lines (33 loc) · 1.08 KB
/
mailSender.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
const send = require('gmail-send')({
user: 'GMAIL_USERNAME',
pass: 'GMAIL_PASSWORD',
});
/**
* Sends the gift sender (santa) the email with the recipients name
*
* @param {String} senderEmail - email of the santa (gift sender)
* @param {String} senderName - name of the gift sender
* @param {String} pairName - name of the gift recepient
*/
module.exports.sendSantaMail = function(senderEmail, senderName, pairName) {
let options = {
subject: 'Secret santa!',
to: senderEmail,
text: `Merry Cristmas ${senderName}!
You have been selected to be the secret santa for ${pairName}!!!
The gift budget is 10$ !
Have a great 202x! :D`
}
/*
//left for testing purposes
console.log("----------------------------")
console.log(options.to)
console.log(options.text)
console.log("----------------------------")
*/
send(options, (error, result, fullResult) => {
if (error)
console.error(error);
console.log("Success sending santa mail to: " + fullResult.envelope.to);
});
}