rendered paste body<html>
<head>
<title> Envia email </title>
</head>
<body>
<?php
$to = $_POST['to'];
$from = $_POST['from'];
$subject = $_POST['subject'];
//$message = 'Nome: ' . $_POST['nome'] . ' Morada: ' . $_POST['morada'];
$message = '';
/*$nome = $_POST['nome'];
$morada = $_POST['nome'];
$localidade = $_POST['nome'];
$cpostal = $_POST['nome'];
$telefone = $_POST['nome'];
$telemovel = $_POST['nome'];
$email = $_POST['nome'];
$nacio = $_POST['nome'];
$dia = $_POST['nome'];
$mes = $_POST['nome'];
$ano = $_POST['nome'];
$sex = $_POST['nome'];
$modelos = $_POST['nome'];
$publicidade = $_POST['nome'];
$hospedeiraspromotoras = $_POST['nome'];
$cabelo = $_POST['nome'];
$peso = $_POST['nome'];
$olhos = $_POST['nome'];
$peito = $_POST['nome'];
$calcado = $_POST['nome'];
$cintura = $_POST['nome'];
$confeccao = $_POST['nome'];
$anca = $_POST['nome'];
$obs = $_POST['nome'];
$altura = $_POST['nome'];
*/
print_r($_FILES);
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$headers = "From: $from";
if (is_uploaded_file($fileatt)) {
// ler ficheiro do attach ('rb' = read binary)
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
// Gera a boundary string
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
// Acrecenta headers para file attachment
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
// Acrescenta a multipart boundary acima da mensagem em texto normal
$message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
// Base64 encode do file
$data = chunk_split(base64_encode($data));
// Acrecenta o ficheiro a msgm...
$message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
}
// Envia a mensagem
$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
echo "<p>Mail enviado</p>";
} else {
echo "<p>Erro</p>";
}
?>
</body>
</html>