-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmailFile.js
47 lines (42 loc) · 1.1 KB
/
mailFile.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
nodemailer = require('nodemailer');
require('dotenv').config();
function sendAttachments(recipient_email) {
myEmail = "rewise_bot.com";
let transport = nodemailer.createTransport({
host: 'smtp.mail.yahoo.com',
port: 465,
secure: false,
service: 'yahoo',
auth: {
user: myEmail,
pass: process.env.PASS
},
debug: false,
logger: true
});
let message= {
from: myEmail,
to: recipient_email,
subject: "Mail from ReWise",
text: "Hey, please find attached your quiz generated with answer keys",
attachements: [
{
path: "./Questions.pdf"
},
{
path: "./Answers.pdf"
}
]
}
transport.sendMail(message, function(err){
if(err){
console.log(err);
console.log("Failed to send email.\n");
return;
}
else{
console.log("Attachments successfully sent!");
}
});
}
module.exports.sendAttachments = sendAttachments;