Hello, everyone. I have a problem. When I try to send an email form on netlify or netlify dev this goes empty.
On my local server this working perfectly.
This is my HTML:
<form id="mailer" method="post" class="contact-form lg-6" action="contact" >
<div class="form-group">
<div class="input-group input-group-lg mb-3">
<input name="Full name" type="text" id="contact-name" class="form-control" placeholder="Full name"aria-label="Name" aria-describedby="inputGroup-sizing-lg" value="" required/>
</div>
<div class="input-group input-group-lg mb-3">
<input name="Company" type="text" id="contact-company" class="form-control" placeholder="Company" aria-label="Company" aria-describedby="inputGroup-sizing-lg" value="" required/>
</div>
<div class="input-group input-group-lg mb-3">
<input name="Email" type="email" id="contact-email" class="form-control" placeholder="Email" aria-label="Email" aria-describedby="inputGroup-sizing-lg" value="" required/>
</div>
<div class="input-group mb-3">
<textarea name="textarea" id="contact-textarea" class="form-control" aria-label="With textarea" value="" required></textarea>
</div>
<button href="#home" type="submit" class="btn btn-primary submit">Send</button>
</div>
</form>
and my JS:
function handleChange(e) {
value = e.target.value;
}
nameInput.addEventListener("blur", handleChange);
companyInput.addEventListener("blur", handleChange);
emailInput.addEventListener("blur", handleChange);
textareaInput.addEventListener("blur", handleChange);
let templateParams = {
from_name: "Contact Mailer",
to_name: `${toEmail}`,
fullName: `${nameInput.value}`,
company: `${companyInput.value}`,
email: `${emailInput.value}`,
msg: `${textareaInput.value}`,
};
form.addEventListener("submit", function (e) {
e.preventDefault();
emailjs.send(serviceID, templateID, templateParams).then(
function (response) {
console.log("SUCCESS!", response.status, response.text);
},
function (error) {
console.log("FAILED...", error);
}
);
nameInput.value = "";
companyInput.value = "";
emailInput.value = "";
textareaInput.value = "";
});
I don’t know where is the problem. Please, help me.