Seguinte ta funcionando, o anexo vem beleza, porem no corpo da mensagem só vem o que é escrito no campo MENSAGEM, o restante: Nome, Email, Empresa e Telefone nao estao vindo... onde é que eu estou errando??? ja que sou uma negaçao em PHP rs.
Condigo do envia.php
CODE
<?
//pega os dados enviados pelo usuário
$nome = $_POST["nome"];
$body = $_POST["mensagem"];
$to = $_POST["email"];
$from = $_POST["email_from"];
$subject = $_POST["assunto"];
$telefone = $_POST["telefone"];
$attach = $_FILES["arquivo"]["tmp_name"];
$attach_name = $_FILES["arquivo"]["name"];
$attach_size = $_FILES["arquivo"]["size"];
$attach_type = $_FILES["arquivo"]["type"];
//verifica se o email do destinatário é válido
if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $to)){
echo"<center>Digite um email valido</center>";
echo "<center><a href=\"java script:history.go(-1)\">Voltar</center></a>";
exit;
}
//verifica se o email do remetente é válido
if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $from)){
echo "<center>Digite um email valido</center>";
echo "<center><a href=\"java script:history.go(-1)\"><center>Voltar</center></a>";
exit;
}
//define os headers de envio
$mailheaders = "From: \"$nome\" <$from>\r\n";
$mailheaders .= "Reply-To: $from\n";
//e define a mensagem tirando barras para evitar problemas no script
$msg_body = stripslashes($body);
$msg_body = stripslashes($nome);
$msg_body = stripslashes($to);
$msg_body = stripslashes($subject);
$msg_body = stripslashes($telefone);
//verifica se tem arquivo anexo, o if é se tiver e o else se não tiver anexo
if ($attach !=null)
{
//abre o arquivo para codificá-lo no formato de email
$file = fopen($attach, "r");
$contents = fread($file, $attach_size);
$encoded_attach = chunk_split(base64_encode($contents));
fclose($file);
//define os cabeçalhos do anexo e da mensagem
$mailheaders .= "MIME-version: 1.0\n";
$mailheaders .= "Content-type: multipart/mixed; ";
$mailheaders .= "boundary=\"Message-Boundary\"\n";
$mailheaders .= "Content-transfer-encoding: 7BIT\n";
$mailheaders .= "X-attachments: $attach_name";
$body_top = "--Message-Boundary\n";
$body_top .= "Content-type: text/plain; charset=US-ASCII\n";
$body_top .= "Content-transfer-encoding: 7BIT\n";
$body_top .= "Content-description: Mail message body\n\n";
$msg_body = $body_top . $msg_body;
$msg_body .= "\n\n--Message-Boundary\n";
$msg_body .= "Content-type: $attach_type; name=\"$attach_name\"\n";
$msg_body .= "Content-Transfer-Encoding: BASE64\n";
$msg_body .= "Content-disposition: attachment; filename=\"$attach_name\"\n\n";
$msg_body .= "$encoded_attach\n";
$msg_body .= "--Message-Boundary--\n";
$msg_body .= "$nome";
$msg_body .= "$to";
$msg_body .= "$subject";
$msg_body .= "$telefone";
//envia o email para as variáveis já definidas e tratadas e mostra mensagem de sucesso
mail($to, stripslashes($subject), $msg_body, $mailheaders);
echo"Enviado com Sucesso!";
echo"<br>";
}
else{
//se não tiver anexo ele envia só a mensagem com esses headers
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: \"$nome\" <$from>\r\n";
mail($to, stripslashes($subject), $msg_body, $mailheaders);
echo"Enviado com Sucesso!";
echo"<br>";
}
?>
//pega os dados enviados pelo usuário
$nome = $_POST["nome"];
$body = $_POST["mensagem"];
$to = $_POST["email"];
$from = $_POST["email_from"];
$subject = $_POST["assunto"];
$telefone = $_POST["telefone"];
$attach = $_FILES["arquivo"]["tmp_name"];
$attach_name = $_FILES["arquivo"]["name"];
$attach_size = $_FILES["arquivo"]["size"];
$attach_type = $_FILES["arquivo"]["type"];
//verifica se o email do destinatário é válido
if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $to)){
echo"<center>Digite um email valido</center>";
echo "<center><a href=\"java script:history.go(-1)\">Voltar</center></a>";
exit;
}
//verifica se o email do remetente é válido
if (!ereg("^([0-9,a-z,A-Z]+)([.,_]([0-9,a-z,A-Z]+))*[@]([0-9,a-z,A-Z]+)([.,_,-]([0-9,a-z,A-Z]+))*[.]([0-9,a-z,A-Z]){2}([0-9,a-z,A-Z])?$", $from)){
echo "<center>Digite um email valido</center>";
echo "<center><a href=\"java script:history.go(-1)\"><center>Voltar</center></a>";
exit;
}
//define os headers de envio
$mailheaders = "From: \"$nome\" <$from>\r\n";
$mailheaders .= "Reply-To: $from\n";
//e define a mensagem tirando barras para evitar problemas no script
$msg_body = stripslashes($body);
$msg_body = stripslashes($nome);
$msg_body = stripslashes($to);
$msg_body = stripslashes($subject);
$msg_body = stripslashes($telefone);
//verifica se tem arquivo anexo, o if é se tiver e o else se não tiver anexo
if ($attach !=null)
{
//abre o arquivo para codificá-lo no formato de email
$file = fopen($attach, "r");
$contents = fread($file, $attach_size);
$encoded_attach = chunk_split(base64_encode($contents));
fclose($file);
//define os cabeçalhos do anexo e da mensagem
$mailheaders .= "MIME-version: 1.0\n";
$mailheaders .= "Content-type: multipart/mixed; ";
$mailheaders .= "boundary=\"Message-Boundary\"\n";
$mailheaders .= "Content-transfer-encoding: 7BIT\n";
$mailheaders .= "X-attachments: $attach_name";
$body_top = "--Message-Boundary\n";
$body_top .= "Content-type: text/plain; charset=US-ASCII\n";
$body_top .= "Content-transfer-encoding: 7BIT\n";
$body_top .= "Content-description: Mail message body\n\n";
$msg_body = $body_top . $msg_body;
$msg_body .= "\n\n--Message-Boundary\n";
$msg_body .= "Content-type: $attach_type; name=\"$attach_name\"\n";
$msg_body .= "Content-Transfer-Encoding: BASE64\n";
$msg_body .= "Content-disposition: attachment; filename=\"$attach_name\"\n\n";
$msg_body .= "$encoded_attach\n";
$msg_body .= "--Message-Boundary--\n";
$msg_body .= "$nome";
$msg_body .= "$to";
$msg_body .= "$subject";
$msg_body .= "$telefone";
//envia o email para as variáveis já definidas e tratadas e mostra mensagem de sucesso
mail($to, stripslashes($subject), $msg_body, $mailheaders);
echo"Enviado com Sucesso!";
echo"<br>";
}
else{
//se não tiver anexo ele envia só a mensagem com esses headers
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: \"$nome\" <$from>\r\n";
mail($to, stripslashes($subject), $msg_body, $mailheaders);
echo"Enviado com Sucesso!";
echo"<br>";
}
?>
Galera! ja estou com meu prazo esgotadaço... me ajudem Por Favor ! ! !

Help














