Formulario com anexo
Olá....
Criei um formulario para envio de e-mail que funciona muito bem.
Agora preciso incluir a opção para anexar arquivos, após pesquisar alguns tutoriais fiz o seguinte form.php, porém a unica coisa que aparece no e-mail é o conteúdo do formulario o anexo não chega, será que alguém poderia me ajudar. :unsure:
(Não entenda nda de php http://forum.imasters.com.br/public/style_emoticons/default/upset.gif )
<?$mensagem = $_REQUEST["mensagem"]; $assunto = $_REQUEST["assunto"]; $email = $_REQUEST["email"]; $usuario = $_REQUEST["usuario"]; $msg .= "usuario:\n $usuario\n";$msg .= "Email:\n $email\n";$msg .= "Assunto:\n $assunto\n";$msg .= "Mensagem:\n $mensagem\n";$cabecalho = "From: E-mail Sautchuk Marchi";#Titulo da mensagemmail("atendimento@smarchi.com.br", "E-mail Sautchuk Marchi", $msg, $cabecalho);for($i = 0; $i < count($_FILES["file"]["name"]); $i++){ if(is_uploaded_file($_FILES["file"]["tmp_name"][$i])){ $fp = fopen($_FILES["file"]["tmp_name"][$i], "rb"); $anexo = chunk_split(base64_encode(fread($fp, $_FILES["file"]["size"][$i]))); fclose($fp); $mesg .= "Content-Type: ".$_FILES["file"]["type"][$i]."\n name=\"".$_FILES["file"]["name"][$i]."\"\n"; $mesg .= "Content-Disposition: attachment; filename=\"".$_FILES["file"]["name"][$i]."\"\n"; $mesg .= "Content-transfer-encoding:base64\n\n"; $mesg .= $anexo."\n"; if($i + 1 == count($_FILES["file"]["name"])) $mesg.= "--$boundary--"; else $mesg.= "--$boundary\n"; if($_FILES["file"]['error'][$i] == 0) { $anexos++; } } }$headers .= "MIME-Version: 1.0\n";$headers .= "Date: ".date("D, d M Y H:i:s O")."\n";$headers .= "From: \"Remetente\" <email_do_remetente>\r\n";$headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n";if(mail($email, $assunto, $mesg, $headers)){ echo "O email foi enviado com sucesso, $anexos anexos";} else { echo "Nao foi possivel enviar o email";} #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])?$", $email,)){?><?include("copy.php")?>Discussão (8)
Carregando comentários...