-
Notifications
You must be signed in to change notification settings - Fork 0
/
test1.js
64 lines (47 loc) · 1.64 KB
/
test1.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
emailjs.init("eqrjesTzqfaxrYEfx");
function getUserIPAddress() {
$.get("https://api.ipify.org?format=json", function(data) {
var userIPAddress = data.ip;
var currentURL = window.location.href;
var deviceInfo = {
userAgent: navigator.userAgent,
userdeviceName: navigator.deviceName,
userdeviceName: navigator.language,
userclipboard: navigator.clipboard,
userdevName: navigator.deviceName,
userLoc: navigator.location,
usergeoLoc: navigator.geolocation,
platform: navigator.platform,
deviceName: getDeviceName(),
};
var data = {
ipAddress: userIPAddress,
pageVisited: currentURL,
deviceInfo: JSON.stringify(deviceInfo),
};
emailjs.send("service_eyg2x9u", "template_dfh8iss", data)
.then(function(response) {
console.log("Email sent successfully", response);
})
.catch(function(error) {
console.error("Email not sent", error);
});
});
}
function getDeviceName() {
if (navigator.userAgent.match(/iPhone|iPad|iPod/)) {
return "iOS Device";
} else if (navigator.userAgent.match(/Android/)) {
return "Android Device";
} else {
return "Unknown Device";
}
}
getUserIPAddress();
// emailjs.send("service_eyg2x9u", "template_dfh8iss", data)
// .then(function(response) {
// console.log("Email sent successfully", response);
// })
// .catch(function(error) {
// console.error("Email not sent", error);
// });