-
Notifications
You must be signed in to change notification settings - Fork 1
/
sendEmail.js
30 lines (28 loc) · 933 Bytes
/
sendEmail.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
// Email
const nodeoutlook = require('nodejs-nodemailer-outlook');
// Firebase
const db = require('./firebase/firebase');
sendEmail = (message, file, filePath) => {
db.collection('admins').get().then(querySnapshot => {
let docs = querySnapshot.docs
for (let doc of docs) {
nodeoutlook.sendEmail({
auth: {
user: "[email protected]",
pass: 'Ngoclinh2906'
},
from: '[email protected]',
to: doc.data().email,
subject: 'CSV to XML System Error',
text: message,
attachments: [{
filename: file,
path: filePath
}],
onError: (e) => console.log(e),
onSuccess: (i) => console.log(i)
});
}
});
}
module.exports = sendEmail;