-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendEmailError.js
More file actions
43 lines (33 loc) · 1.03 KB
/
Copy pathsendEmailError.js
File metadata and controls
43 lines (33 loc) · 1.03 KB
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
// emailSender.js
const nodemailer = require('nodemailer');
// Function to send an email
async function sendEmail(saltKey, district,lgd_code, khasra_no ) {
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: 'testqgis99@gmail.com', // Your Gmail email address
pass: 'kmxc ewjy bjrn gfrx' // Your app-specific password
}
});
const subject = `API: Error Code - Salt Key: ${saltKey}`;
const mailOptions = {
from: 'testqgis99@gmail.com',
to: 'jalindarjk12@gmail.com, info@jntpune.com, jaspune@gmail.com',
subject: subject,
text: `
Hello,
This email includes the following variables:
Salt Key: ${saltKey}
District: ${district}
LGD Code: ${lgd_code}
Khasra Number: ${khasra_no}
`
};
try {
const info = await transporter.sendMail(mailOptions);
console.log('Email sent:', info.response);
} catch (error) {
console.error('Error sending email:', error);
}
}
module.exports = { sendEmail };