-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontato.php
29 lines (27 loc) · 1.02 KB
/
contato.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
<?php
$nomeUser = $_POST["nomeUser"];
$emailUser = $_POST["emailUser"];
$assuntoUser = $_POST["assuntoUser"];
$msgUser = $_POST["msgUser"];
if (!empty($nomeUser) && !empty($emailUser) && !empty($assuntoUser) && !empty($msgUser)) {
$to = "[email protected]";
$subject = $assuntoUser;
$body = "Nome: " . $nomeUser . "\r\n"
. "E-mail: " . $emailUser . "\r\n"
. "Mensagem: " . $msgUser;
$header = "From:[email protected]" . "\r\n"
. "Reply-to:" . $emailUser . "\r\n"
. "X-Mailer: PHP/" . phpversion();
if (mail($to,$subject,$body,$header)) {
echo "<script>
window.location.href = 'index.html';
alert('Mensagem enviada com sucesso!');
</script>";
} else {
echo "<script>
window.location.href = 'index.html';
alert('Erro ao enviar a mensagem!');
</script>";
}
}
?>