Repository navigation
Expand file tree
/
Copy pathsendApprovedRefund.js
More file actions
67 lines (56 loc) · 1.94 KB
/
Copy pathsendApprovedRefund.js
File metadata and controls
67 lines (56 loc) · 1.94 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import nodemailer from "nodemailer";
import dotenv from "dotenv";
dotenv.config();
export const sendApproval= async (email, subject, url, user, totalPrice) => {
try {
const transporter = nodemailer.createTransport({
// host: process.env.HOST,
service: "gmail",
port: 465,
secure: true,
// logger: true,
// debug:true,
secureConnection: false,
auth: {
user: "engineerfranklyn@gmail.com",
pass: process.env.PASS
},
tls: {
rejectUnauthorized: true
}
});
await transporter.sendMail({
from: process.env.USER,
to: email,
subject: subject,
html: `<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Team2furnitureStore - Refund Decison</title>
</head>
<body>
<!-- partial:index.partial.html -->
<div style="font-family: Helvetica,Arial,sans-serif;min-width:800px;overflow:auto;line-height:2">
<div style="margin:5px ;width:60%;padding:20px 0">
<div style="border-bottom:1px solid #eee">
<a href="" style="font-size:1.4em;color: orangered;text-decoration:none;font-weight:600">Team2FurnitureStore</a>
</div>
<p style="font-size:2em">Hi, ${user}</p>
<p style="font-size:1.2em">We have approved your Refund request, please allow 3-5 business days for the funds to arrive your bank account.</p>
<p style="font-size:0.9em;">Sincerely,<br />Team2FurnitureStore Crew</p>
<hr style="border:none;border-top:1px solid #eee" />
<div style="float:right;padding:8px 0;color:#aaa;font-size:0.8em;line-height:1;font-weight:300">
</div>
</div>
</div>
<!-- partial -->
</body>
</html>`,
});
console.log("Email sent successfully");
} catch (error) {
console.log("Email not sent");
console.log(error);
}
};