-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (21 loc) · 915 Bytes
/
Copy pathscript.js
File metadata and controls
25 lines (21 loc) · 915 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
// Include EmailJS SDK (if not already included in your HTML)
const emailForm = document.getElementById("emailForm");
emailForm.addEventListener("submit", function (e) {
e.preventDefault(); // Prevent form from submitting normally
// Get the email input value
const email = document.getElementById("email").value;
// EmailJS configuration
emailjs.init("YOUR_USER_ID"); // Replace with your EmailJS user ID
// Send email using the template ID
emailjs.send("YOUR_SERVICE_ID", "template_oivaqpp", {
user_email: email, // This refers to the email entered by the user
})
.then((response) => {
alert("Thank you! Email submitted successfully.");
console.log("Email sent successfully:", response);
})
.catch((error) => {
alert("Oops! Something went wrong. Please try again.");
console.error("Error sending email:", error);
});
});