| |
LISTA PHP |
só uma idéia: http://phpmailer.codeworxtech.com/ On Thu, May 15, 2008 at 2:16 PM, Vitor de Oliveira <vito...@gmail.com> > Esse meu codigo de envio de email com anexo esta funcionando mas o > Segue abaixo o codigo > <?php $from = "cont...@webforte.com.br"; > $mailheaders = "From: $from\n"; > $msg_body = stripslashes($body); > $attach = "xml_xsl.pdf"; > $file = fopen($attach, "r"); > $mailheaders .= "MIME-version: 1.0\n"; > $body_top = "--Message-Boundary\n"; > $msg_body = $body_top . $msg_body; > $msg_body .= "\n\n--Message-Boundary\n"; > $mensagem = mail($to, > if ($mensagem) {
wrote:
> anexo nao aparece com a extensão correta aparece . dat e o correto
> seria .pdf
> $to = "vitor.carva...@hcscomp.com.br";
> $body = "Corpo do email";
> $subject = "Assunto do email";
> $mailheaders .= "X-Mailer: Script para
> enviar arquivo atachado\n";
> $attach_size = filesize($attach);
> $attach_name = "xml_xsl";
> $attach_type = filetype($attach);
> $contents = fread($file, $attach_size);
> $encoded_attach =
> chunk_split(base64_encode($contents));
> fclose($file);
> $mailheaders .= "Content-type:
> multipart/mixed; ";
> $mailheaders .=
> "boundary=\"Message-Boundary\"\n";
> $mailheaders .= "Content-transfer-encoding:
> 7BIT\n";
> $mailheaders .= "X-attachments:
> $attach_name";
> $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 .= "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";
> stripslashes($subject), $msg_body,
> $mailheaders);
> print "E-mail enviado com sucesso!";
> } else {
> print "O envio do email falhou!";
> }
> ?>
Att,
Rafael Procópio Vale
51 - 3037-2276
www.infoccus.com.br