<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Captação de Leads</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
text-align: center;
}
input[type="text"], input[type="email"] {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h2>Cadastre-se</h2>
<form action="processa_formulario.php" method="post">
<input type="text" name="nome" placeholder="Seu Nome" required>
<input type="email" name="email" placeholder="Seu E-mail" required>
<input type="submit" value="Enviar">
</form>
</div>
</body>
</html>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$nome = filter_var($_POST['nome'], FILTER_SANITIZE_STRING);
$email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
$to = 'marcelodefazzio@gmail.com';
$subject = 'Novo Lead Captado';
$message = "Nome: $nome\nE-mail: $email";
$headers = "From: noreply@seusite.com\r\n" .
"Reply-To: $email\r\n" .
"X-Mailer: PHP/" . phpversion();
if (mail($to, $subject, $message, $headers)) {
echo "Obrigado por se cadastrar!";
} else {
echo "Desculpe, ocorreu um erro. Tente novamente mais tarde.";
}
} else {
echo "Método de requisição inválido.";
}
?>