<html>
<head>
<title> Enviando E-mail... </title>
<meta charset="UTF-8">
</head>
<body>
<?php
// primeiro de tudo, faça uma validação nos campos para não enviar o email em branco
// vou fazer só uma aqui, como exemplo
// se não existir o campo email, "mata" todo o código
if (!isset($_POST['email'])) {
die();
}
$emaildestino = $_POST['subcategoria'];
$nome = $_POST['nome'];
$sobrenome = $_POST['sobrenome'];
$email = $_POST['email'];
$telefone = $_POST['telefone'];
$descricao = $_POST['mensagem'];
$arquivo = $_FILES["arquivo"];
$boundary = "XYZ-".date("dmYis")."-ZYX";
$fp = fopen($arquivo["tmp_name"], "rb");
$anexo = fread($fp, filesize($arquivo["tmp_name"]));
$anexo = base64_encode($anexo);
fclose($fp);
// cabeçalho do email
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; ";
$headers .= "boundary=\"$boundary\"\r\n";
$headers .= "From: $email\n";
$headers .= "$boundary\n";
// email
$data = "--$boundary\n";
$data .= "Content-Type: text/html; charset='utf-8'\n";
$data .= "<strong>Nome: </strong> $nome \r\n";
$data .= "<strong>Sobrenome: </strong> $sobrenome \r\n";
$data .= "<strong>E-mail: </strong> $email \r\n";
$data .= "<strong>Telefone: </strong> $telefone \r\n";
$data .= "<strong>Menssagem: </strong> $descricao \r\n";
$data .= "--$boundary \n";
// anexo
$data .= "Content-Type: ".$arquivo["type"]."; name=".$arquivo['name']."\n";
$data .= "Content-Transfer-Encoding: base64 \n";
$data .= "Content-Disposition: attachment; filename=".$arquivo['name']."\r\n";
$data .= "$anexo \n";
$data .= "--$boundary \n";
$send = mail($emaildestino, "Email do Site Rastro Legal - Habilitações/Divergências", $data, $headers);
if (!$send) {
echo 'Ocorreu algum erro, tente novamente';
die();
}
?>
<META HTTP-EQUIV=REFRESH CONTENT='0; URL=habilitacoes-e-divergencias'>
<script type="text/javascript">alert("Mensagem Enviada com Sucesso.");</script>
</body>
</html>
- Output for git.master, git.master_jit, rfc.property-hooks
- <html>
<head>
<title> Enviando E-mail... </title>
<meta charset="UTF-8">
</head>
<body>
This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.
Active branches
Archived branches
Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page
preferences:
55.48 ms | 401 KiB | 8 Q