sendEmail.js
6.38 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import nodemailer from "nodemailer";
export default function (req, res) {
// let nodemailer = require("nodemailer");
const transporter = nodemailer.createTransport({
port: 465,
host: "smtp.gmail.com",
auth: {
user: "dheeraj.realatte@gmail.com",
pass: "pamoocbnzfqhigdf",
},
secure: true,
});
var maillist = ["sujatalogicloop@gmail.com"];
const mailData = {
from: ["sujatalogicloop@gmail.com"],
to: maillist,
subject: `Advith Consulting Contact Form Leads`,
html: `
<table border="0" cellpadding="0" cellspacing="0" style="padding-top:35px; background-color:#f1f1f1; font-family:Verdana,Arial,sans-serif; color:#454748; width:100%; border-collapse:separate;">
<tbody>
<tr>
<td align="center">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="padding:16px; background-color:white; color:#454748; border-collapse:separate;">
<tbody>
<tr>
<td align="center" style="min-width:590px;">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width:590px; background-color:white; padding:0px 8px 0px 8px; border-collapse:separate;">
<tbody>
<tr>
<td valign="middle">
<strong style="font-size:16px; margin: 0;">Welcome to Advith Consulting</strong>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<hr width="100%" style="border-top-color:rgba(0,0,0,0.1); border-top-style:solid; border-top-width:1px; border-left-width:0px; border-bottom-width:0px; border-right-width:0px; overflow-y:visible; overflow-x:visible; height:0px; box-sizing:content-box; background-color:rgb(204,204,204); border:medium none; clear:both; display:block; font-size:0px; min-height:1px; line-height:0; margin:16px 0px 16px 0px;">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center" style="min-width:590px;">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width:590px; background-color:white; padding:0px 8px 0px 8px; border-collapse:separate;">
<tbody>
<tr>
<td colspan="2" valign="top" style="font-size:13px;">
<div style="font-size:13px; font-family:"Lucida Grande",Helvetica,Verdana,Arial,sans-serif;">
Details below are enquiry from website!<br><br>
</div>
</td>
</tr>
<tr>
<td valign="top" style="font-size:13px;">
<div style="font-size:13px; font-family:"Lucida Grande",Helvetica,Verdana,Arial,sans-serif;">
<tr><td colspan="2"><b>Personal Details:</b></td></tr>
<tr><td style="width: 30%;">Name:</td><td style="width: 70%;">${req.body.Name}</td></tr>
<tr><td style="width: 30%;">Email:</td><td style="width: 70%;">${req.body.Email}</td></tr>
<tr><td style="width: 30%;">Mobile:</td><td style="width: 70%;">${req.body.Mobile}</td></tr>
<tr><td style="width: 30%;">Company:</td><td style="width: 70%;">${req.body.Company}</td></tr>
<tr><td style="width: 30%;">Message:</td><td style="width: 70%;">${req.body.AdditionalMessage }</td></tr>
<br><br>
</div>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<hr width="100%" style="border-top-color:rgba(0,0,0,0.1); border-top-style:solid; border-top-width:1px; border-left-width:0px; border-bottom-width:0px; border-right-width:0px; overflow-y:visible; overflow-x:visible; height:0px; box-sizing:content-box; background-color:rgb(204,204,204); border:medium none; clear:both; display:block; font-size:0px; min-height:1px; line-height:0; margin:16px 0px 16px 0px;">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td align="center" style="min-width:590px;">
<table border="0" cellpadding="0" cellspacing="0" width="590" style="min-width:590px; background-color:#f1f1f1; color:#454748; padding:8px; border-collapse:separate;">
<tbody>
<tr>
<td style="text-align:center; font-size:13px;"><br></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>`,
};
transporter.sendMail(mailData, function (err, info) {
if (err) console.log(err);
else console.log(info);
});
console.log(req.body);
res.send("success");
}