-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendEmail.js
More file actions
31 lines (28 loc) · 778 Bytes
/
sendEmail.js
File metadata and controls
31 lines (28 loc) · 778 Bytes
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
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: process.env.SERVICE,
host:process.env.HOST,
port:Number( process.env.PORT),
secure: Boolean(process.env.SECURE),
auth: {
user: process.env.USER,
pass: process.env.PASS
}
});
const sendEmail = async (email,subject,text) =>{
const mailOptions = {
from: 'sohamsawant075@gmail.com',
to: email,
subject: subject,
text: text,
};
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
console.error('Error sending email:', error);
} else {
console.log('Email sent:', info.response);
}
});
console.log("reached")
}
module.exports = sendEmail ;