Skip to content

Commit b8b387c

Browse files
committed
added mailing support
1 parent 6581301 commit b8b387c

File tree

5 files changed

+8432
-2293
lines changed

5 files changed

+8432
-2293
lines changed

emails/mailer.js

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
1-
/*
2-
under construction
1+
const nodemailer = require("nodemailer")
32

4-
*/
3+
let transporter = nodemailer.createTransport({
4+
service: 'gmail',
5+
auth: {
6+
user: process.env.EMAIL,
7+
pass: process.end.PASSWORD
8+
}
9+
});
10+
11+
const sendEmailOnWelcome = function (email, name) {
12+
13+
let mailOptions = {
14+
from: process.env.EMAIL,
15+
to: email,
16+
subject: 'New Message from ' + "Anurag",
17+
text: `Hello ${name}! Welcome to our app`
18+
};
19+
20+
transporter.sendMail(mailOptions);
21+
22+
}
23+
const sendEmailOnDelete = function (email, name) {
24+
25+
let mailOptions = {
26+
from: process.env.EMAIL,
27+
to: email,
28+
subject: 'New Message from ' + "Anurag",
29+
text: `Dear ${name}, sad to say you good bye!`
30+
};
31+
32+
transporter.sendMail(mailOptions);
33+
34+
}
35+
36+
module.exports = {
37+
sendEmailOnWelcome,
38+
sendEmailOnDelete
39+
}

0 commit comments

Comments
 (0)