forked from yogeshswdev/html5_CSS_JavaScript_JQuery_start
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact1.js
More file actions
26 lines (24 loc) · 883 Bytes
/
contact1.js
File metadata and controls
26 lines (24 loc) · 883 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
26
function SendMail() {
var params = {
from_name : document.getElementById("fullName").value,
email_id : document.getElementById("email_id").value,
message : document.getElementById("message").value
}
var c=document.getElementById("email_id").value;
let emailformat =/^[a-zA-Z0-9.!#$%&'+/=?^_`{|}~-]+@gmail+(?:\.[a-zA-Z0-9-]+)$/;
var p=document.getElementById("phone").value;
let phoneformat =/^\d{10}$/;
if(phoneformat.test(p) && emailformat.test(c)){
emailjs.send("service_mg135d3", "template_t854sys", params).then(function (res) {
alert("Success! " + res.status);
})
}
else {
if(!emailformat.test(c)){
alert("Enter a valid mailid!!")
}
if(!phoneformat.test(p)){
alert("Enter a valid phone number!!")
}
}
}