-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsendemailpage.php
173 lines (130 loc) · 4.91 KB
/
sendemailpage.php
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!doctype html>
<html lang="it">
<head>
<meta charset='utf-8'>
<meta name='description' class='put-head-desc-here' content=''>
<meta name='keywords' class='put-head-keys-here' content=''>
</head>
<script type="text/javascript" src="js/genericFunctions.js"></script>
<script type="text/javascript" src="js/functions.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/js/materialize.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Slabo+27px" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Noto+Sans" rel="stylesheet">
<script src='https://www.google.com/recaptcha/api.js'></script> <!-- For secure form submission -->
<body>
<?php include("lib/nav.html") ?>
<!-- ************************************************************************************** -->
<div class="container" style="width:80%!important;">
<div class="row">
<div class="col l12 s12">
<h4 class="put-title-here0"></h4>
</div>
</div>
<div id="contattaci" class="row">
<div class="col l8 s12">
<h4>Contattaci</h4>
</div>
</div>
<div class="row">
<div class="col l8 s12">
<div class="card white">
<div class="card-content">
<p>
<div class="input-field">
<input id="usersubject" type="text" data-length="40">
<label for="usersubject">Oggetto</label>
</div>
<div class="input-field">
<input id="username" type="text" data-length="40">
<label for="username">Nome</label>
</div>
<div class="input-field">
<input id="useremail" type="text" data-length="40">
<label for="useremail">Email</label>
</div>
<div class="input-field">
<textarea id="usercomments" class="materialize-textarea" data-length="1000"></textarea>
<label for="usercomments">Messaggio</label>
</div>
<label>
<input type="checkbox" id="userauth" />
<span>Autorizzo il trattamento dei dati (GDPR 2016/679).</span>
</label>
<br><br>
<div class="g-recaptcha" data-sitekey="****************************"></div>
</p>
</div>
<div class="card-action">
<a id="submitmessage" class="btn-flat color1-text">Invia messaggio <i class="material-icons color1-text right">send</i></a>
</div>
</div>
</div>
</div>
</div>
<!-- ************************************************************************************** -->
<?php include("lib/footer.html") ?>
</body>
<script>
createHead();
generatePage("informazioni", "0");
</script>
<script>
$("#submitmessage").click(function() {
var data = {
UserSubject: $("#usersubject").val(),
UserName: $("#username").val(),
UserEmail: $("#useremail").val(),
UserComments: $("#usercomments").val(),
UserAuth: $('#userauth').is(":checked"),
UserCaptcha: grecaptcha.getResponse()
};
$.ajax(
{
url: 'api/SendEmail.php',
type: 'POST',
data: data,
dataType: 'json',
success: function(data)
{
var obj = data.Sent;
if(obj.payload == "sent"){
swal({
title: 'Grazie!',
html: 'Messaggio inviato correttamente!<br><br>',
showCloseButton: false,
showCancelButton: false,
showConfirmButton: true,
buttonsStyling: false,
animation: false,
position: 'center',
customClass: 'z-depth-3 modal-font',
confirmButtonClass: 'btn-flat color1-text',
confirmButtonText: 'Ok',
buttonsStyling: false,
allowOutsideClick: false // prevent user by clicking outside instead of clickinf "ok"
}).then(function () {
window.location.replace("/") // redirect after clicking "ok"
})
}
if(obj.payload == "error"){
swal({
title: 'Errore',
html: 'Controlla i dati mancanti.<br><br>',
position: 'center',
customClass: 'z-depth-3 modal-font',
buttonsStyling: false,
confirmButtonClass: 'btn-flat color1-text',
confirmButtonText: 'Ok',
buttonsStyling: false,
// showCancelButton: true,
// cancelButtonClass: 'mdl-button close',
// cancelButtonText: 'Annulla',
})
}
} // end of function
}); // end of ajax call
});
</script>
</html>