-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
82 lines (72 loc) · 2.46 KB
/
script.js
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
let hamMenuIcon = document.getElementById("ham-menu");
let navBar = document.getElementById("nav-bar");
let navLinks = navBar.querySelectorAll("li");
hamMenuIcon.addEventListener("click", () => {
navBar.classList.toggle("active");
hamMenuIcon.classList.toggle("fa-times");
});
navLinks.forEach((navLinks) => {
navLinks.addEventListener("click", () => {
navBar.classList.remove("active");
hamMenuIcon.classList.toggle("fa-times");
});
});
function myFunction() {
var element = document.body;
element.classList.toggle("dark-mode");
}
function sendEmail() {
Email.send({
Host: "smtp.gmail.com",
Username: "[email protected]",
Password: "Anil@123",
To: '[email protected]',
From: document.getElementById("email").value,
Subject: "new contact form Enquiry",
Body: "Name: " + document.getElementById("name").value
+ "<br> Email:" + document.getElementById("email").value
+ "<br> message:" + document.getElementById("message").value
}).then(
message => alert(message)
);
};
// const express = require('express');
// const nodemailer = require('nodemailer');
// const path = require('path');
// const app = express();
// const PORT = process.env.PORT || 3000;
// // Serve static files (HTML, CSS, JavaScript)
// app.use(express.static(path.join(__dirname, 'public')));
// // Parse JSON and URL-encoded data
// app.use(express.json());
// app.use(express.urlencoded({ extended: true }));
// // Contact form submission route
// app.post('/send-email', (req, res) => {
// const { name, email, message } = req.body;
// // Configure a nodemailer transporter for sending email
// const transporter = nodemailer.createTransport({
// service: 'Gmail',
// auth: {
// user: '[email protected]',
// pass: 'your-email-password',
// },
// });
// const mailOptions = {
// from: email,
// to: '[email protected]',
// subject: `Contact form submission from ${name}`,
// text: message,
// };
// transporter.sendMail(mailOptions, (error, info) => {
// if (error) {
// console.error(error);
// res.status(500).json({ message: 'Error sending email.' });
// } else {
// console.log('Email sent: ' + info.response);
// res.json({ message: 'Email sent successfully.' });
// }
// });
// });
// app.listen(PORT, () => {
// console.log(`Server is running on port ${PORT}`);
// });