forked from pedropamn/fastdanfe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail.php
40 lines (34 loc) · 1.97 KB
/
mail.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
<?php
/*
// the message
$nome = $_POST['nome'];
$email = $_POST['email'];
$msg_campo = $_POST['mensagem'];
$msg = "Nome:{$nome} -- Email: {$email} -- Mensagem: {$msg_campo}";
// send email
$data = array("value1" => $msg);
$data_string = json_encode($data);
$ch = curl_init('https://maker.ifttt.com/trigger/msg_site_nfe/with/key/thekey');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
if($result){
echo "Mensagem enviada. Obrigado! <a href='index.php'>Voltar</a>";
}
else{
echo "Erro ao enviar. Tente novamente <a href='index.php'>Voltar</a>";
sleep(2);
}
//header("Location:index.php");
*/
$nome = $_POST['nome'];
$email = $_POST['email'];
$message = $_POST['mensagem'];
mail($to, $subject, $message);
header("Location:index.php");
?>