-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontato.php
30 lines (25 loc) · 956 Bytes
/
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
30
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
$nome = $_POST['nome'];
$email = $_POST['email'];
$mensagem = $_POST['mensagem'];
require 'vendor/autoload.php';
$from = new SendGrid\Email(null, "[email protected]");
$subject = "Mensagem de contato";
$to = new SendGrid\Email(null, "[email protected]");
$content = new SendGrid\Content("text/html", "Olá Cesar, <br><br>Nova mensagem de contato<br><br>Nome: $nome<br>Email: $email <br>Mensagem: $mensagem");
$mail = new SendGrid\Mail($from, $subject, $to, $content);
//Necessário inserir a chave
$apiKey = 'SENDGRID_API_KEY';
$sg = new \SendGrid($apiKey);
$response = $sg->client->mail()->send()->post($mail);
echo "Mensagem enviada com sucesso";
?>
</body>
</html>