Jump to content


Photo

Enviar Email Com Axexo


  • Faça o login para participar
Nenhuma resposta neste tópico

#1 WeeD

WeeD

    12 Horas

  • Usuários
  • 166 posts
  • Sexo:Não informado

Posted 23/11/2005, 15:12

ae fazendo favor, alguem pode me falar porque não esta indo o anexo junto ? tipo o email chega normal no destino mas sem anexo!

<?php
  $acao = $_GET["acao"];
  if ($acao == "enviar") {
      $nome      = $_POST["NOME"];
      $assunto   = $_POST["ASSUNTO"];
      $remetente = $_POST["EMAIL"];
      $destino   = $_POST["OPCOES"];
      $mensagem  = $_POST["TEXTO"];

      $mensagem  = wordwrap($mensagem,50,"<br>",1);

      $arquivo   = isset($_FILES["ARQUIVO"]) ? $_FILES["ARQUIVO"] : FALSE;

      if (file_exists($arquivo["tmp_name"]) and !empty($arquivo)) {
          $fp    = fopen($_FILES["ARQUIVO"]["tmp_name"],"rb");
          $anexo = fread($fp,filesize($_FILES["ARQUIVO"]["tmp_name"]));
          $anexo = base64_encode($anexo);

          fclose($fp);

          $anexo    = chunk_split($anexo);
          $boundary = "XYZ-" . date("dmYis") . "-ZYX";

          $texto    = "--$boundary\n";
          $texto   .= "Content-Transfer-Encoding: 8bits\n";
          $texto   .= "Content-Type: text/html; charset=\"ISO-8859-1\"\n\n";
          $texto   .= "$mensagem\n";
          $texto   .= "--$boundary\n";
          $texto   .= "Content-Type: ".$arquivo["type"]."\n";
          $texto   .= "Content-Disposition: attachment; filename=\"".$arquivo["name"]."\"\n";
          $texto   .= "Content-Transfer-Encoding: base64\n\n";
          $texto   .= "$anexo\n";
          $texto   .= "--$boundary--\r\n";

          $headers  = "MIME-Version: 1.0\n";
          $headers .= "From: \"$nome\" <$remetente>\r\n";
          $headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n";
          $headers .= "$boundary\n";

          $Enviar=mail($destino,$assunto,$texto,$headers);

          echo"Email enviado com Sucesso!";
      }
      else {
           $headers  = "MIME-Version: 1.0\r\n";
           $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
           $headers .= "From: \"$nome\" <$remetente>\r\n";

           $Enviar=mail($destino,$assunto,$mensagem,$headers);

           echo"Email enviado com Sucesso!";
      }
  }
?>

Obriagdo!
còé ?




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq