Mensagem sobre o tópico
Ajuda!! Envio de email com anexo
Received: by 10.90.92.14 with SMTP id p14mr1603206agb.18.1210872175372;
Thu, 15 May 2008 10:22:55 -0700 (PDT)
Return-Path: <rafael.infoc...@gmail.com>
Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.155])
by mx.google.com with ESMTP id 22si22263835yxr.2.2008.05.15.10.22.53;
Thu, 15 May 2008 10:22:55 -0700 (PDT)
Received-SPF: pass (google.com: domain of rafael.infoc...@gmail.com designates 72.14.220.155 as permitted sender) client-ip=72.14.220.155;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of rafael.infoc...@gmail.com designates 72.14.220.155 as permitted sender) smtp.mail=rafael.infoc...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by fg-out-1718.google.com with SMTP id l27so405251fgb.21
for <listaphp@googlegroups.com>; Thu, 15 May 2008 10:22:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references;
bh=RwRxlY+YK/w8G1HjVHU0hfs1bSicaiX6qJcWipmdCNY=;
b=KGkuSl/W4WifF31nPoGX/fje/aNSqgI8xMSb9jDhZd9//WeEbEWFX/PmWFsPclo3txMoZIeMvjSYhpT+usLqWQ4BNgbW823iQCITxRPNg634YsGZa6A68Z3LbOjozO3EgYJ+blATKXxPW1tsO2v8QKaPw4zBLDUZfaS9WIgJ3J8=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=gamma;
h=message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references;
b=v8+lfF4XrGddj2CtjbC4tLaxeAHAqDaSUMoIvcStoGBkZxIdAuuRSmkDl9FD5APmGR1f3BGe57b2EHEpjJ4EgQXg22Q5e7KkZIcDLjw5gquL3AbNA4IgaTETwrLGpqhiEimMHm/Bs67ds6F/4y+NzeEWvF73FfGI7BvwVZj+lUY=
Received: by 10.82.105.1 with SMTP id d1mr376618buc.26.1210872173238;
Thu, 15 May 2008 10:22:53 -0700 (PDT)
Received: by 10.82.124.14 with HTTP; Thu, 15 May 2008 10:22:53 -0700 (PDT)
Message-ID: <5c6db75a0805151022x2c5a049du3f5472b9a82177f7@mail.gmail.com>
Date: Thu, 15 May 2008 14:22:53 -0300
From: "Rafael Vale" <rafael.infoc...@gmail.com>
Reply-To: raf...@infoccus.com.br
To: listaphp@googlegroups.com
Subject: Re: [ PHP - Google ] Ajuda!! Envio de email com anexo
In-Reply-To: <90b7a277-96ad-4eaf-90c9-e282fb4ef...@59g2000hsb.googlegroups.com>
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_4298_3045178.1210872173250"
References: <90b7a277-96ad-4eaf-90c9-e282fb4ef...@59g2000hsb.googlegroups.com>
------=_Part_4298_3045178.1210872173250
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
s=F3 uma id=E9ia:
http://phpmailer.codeworxtech.com/
On Thu, May 15, 2008 at 2:16 PM, Vitor de Oliveira <vito...@gmail.com>
wrote:
>
> Esse meu codigo de envio de email com anexo esta funcionando mas o
> anexo nao aparece com a extens=E3o correta aparece . dat e o correto
> seria .pdf
>
> Segue abaixo o codigo
>
> <?php $from =3D "cont...@webforte.com.br";
> $to =3D "vitor.carva...@hcscomp.com.br";
> $body =3D "Corpo do email";
> $subject =3D "Assunto do email";
>
>
>
> $mailheaders =3D "From: $from\n";
> $mailheaders .=3D "X-Mailer: Script para
> enviar arquivo atachado\n";
>
> $msg_body =3D stripslashes($body);
>
> $attach =3D "xml_xsl.pdf";
> $attach_size =3D filesize($attach);
> $attach_name =3D "xml_xsl";
> $attach_type =3D filetype($attach);
>
>
> $file =3D fopen($attach, "r");
> $contents =3D fread($file, $attach_size);
> $encoded_attach =3D
> chunk_split(base64_encode($contents));
> fclose($file);
>
> $mailheaders .=3D "MIME-version: 1.0\n";
> $mailheaders .=3D "Content-type:
> multipart/mixed; ";
> $mailheaders .=3D
> "boundary=3D\"Message-Boundary\"\n";
> $mailheaders .=3D "Content-transfer-encodin=
g:
> 7BIT\n";
> $mailheaders .=3D "X-attachments:
> $attach_name";
>
> $body_top =3D "--Message-Boundary\n";
> $body_top .=3D "Content-type: text/plain;
> charset=3DUS-ASCII\n";
> $body_top .=3D "Content-transfer-encoding:
> 7BIT\n";
> $body_top .=3D "Content-description: Mail
> message body\n\n";
>
> $msg_body =3D $body_top . $msg_body;
>
> $msg_body .=3D "\n\n--Message-Boundary\n";
> $msg_body .=3D "Content-type: $attach_type;
> name=3D\"$attach_name
> \"\n";
> $msg_body .=3D "Content-Transfer-Encoding:
> BASE64\n";
> $msg_body .=3D "Content-disposition:
> attachment; filename=3D
> \"$attach_name\"\n\n";
> $msg_body .=3D "$encoded_attach\n";
> $msg_body .=3D "--Message-Boundary--\n";
>
>
> $mensagem =3D mail($to,
> stripslashes($subject), $msg_body,
> $mailheaders);
>
> if ($mensagem) {
> print "E-mail enviado com sucesso!";
> } else {
> print "O envio do email falhou!";
> }
> ?>
> >
>
--=20
Att,
Rafael Proc=F3pio Vale
51 - 3037-2276
www.infoccus.com.br
------=_Part_4298_3045178.1210872173250
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
s=F3 uma id=E9ia:<br><br><a href=3D"http://phpmailer.codeworxtech.com/">http=
://phpmailer.codeworxtech.com/</a><br><br><div class=3D"gmail_quote">On Thu,=
May 15, 2008 at 2:16 PM, Vitor de Oliveira <<a href=3D"mailto:vitorbh@gm=
ail.com">vito...@gmail.com</a>> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 2=
04, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Esse meu codigo de envio de email com anexo esta funcionando mas o<br>
anexo nao aparece com a extens=E3o correta aparece . dat e o correto<br>
seria .pdf<br>
<br>
Segue abaixo o codigo<br>
<br>
<?php $fro=
m =3D "<a href=3D"mailto:cont...@webforte.com.br">cont...@webforte.com.=
br</a>";<br>
 =
; $to =3D "<a href=3D"mailto:vitor.carva...@hcscomp.com.br">vitor=
.carva...@hcscomp.com.br</a>";<br>
 =
; $body =3D "Corpo do email";<br>
 =
; $subject =3D "Assunto do email";<br>
<br>
<br>
<br>
 =
; $mailheaders =3D "From: $from\n&quo=
t;;<br>
 =
; $mailheaders .=3D "X-Mailer: Script=
para enviar arquivo atachado\n";<br>
<br>
 =
; $msg_body =3D stripslashes($body);<br>
<br>
 =
; $attach =3D "xml_xsl.pdf";<br>
 =
; $attach_size =3D filesize($attach);<br>
 =
; $attach_name =3D "xml_xsl";<br=
>
 =
; $attach_type =3D filetype($attach);<br>
<br>
<br>
 =
; $file =3D fopen($attach, "r");=
<br>
 =
; $contents =3D fread($file, $attach_size)=
;<br>
 =
; $encoded_attach =3D chunk_split(base64_e=
ncode($contents));<br>
 =
; fclose($file);<br>
<br>
 =
; $mailheaders .=3D "MIME-version: 1.=
0\n";<br>
 =
; $mailheaders .=3D "Content-type: mu=
ltipart/mixed; ";<br>
 =
; $mailheaders .=3D "boundary=3D\&quo=
t;Message-Boundary\"\n";<br>
 =
; $mailheaders .=3D "Content-transfer=
-encoding: 7BIT\n";<br>
 =
; $mailheaders .=3D "X-attachments: $=
attach_name";<br>
<br>
 =
; $body_top =3D "--Message-Boundary\n=
";<br>
 =
; $body_top .=3D "Content-type: text/=
plain; charset=3DUS-ASCII\n";<br>
 =
; $body_top .=3D "Content-transfer-en=
coding: 7BIT\n";<br>
 =
; $body_top .=3D "Content-description=
: Mail message body\n\n";<br>
<br>
 =
; $msg_body =3D $body_top . $msg_body;<br>
<br>
 =
; $msg_body .=3D "\n\n--Message-Bound=
ary\n";<br>
 =
; $msg_body .=3D "Content-type: $atta=
ch_type; name=3D\"$attach_name<br>
\"\n";<br>
 =
; $msg_body .=3D "Content-Transfer-En=
coding: BASE64\n";<br>
 =
; $msg_body .=3D "Content-disposition=
: attachment; filename=3D<br>
\"$attach_name\"\n\n";<br>
 =
; $msg_body .=3D "$encoded_attach\n&q=
uot;;<br>
 =
; $msg_body .=3D "--Message-Boundary-=
-\n";<br>
<br>
<br>
 =
; $mensagem =3D mail($to, stripslashes($su=
bject), $msg_body,<br>
$mailheaders);<br>
<br>
 =
; if ($mensagem) {<br>
 =
; print "E-mail enviado com sucesso!&=
quot;;<br>
 =
; } else {<br>
 =
; print "O envio do email falhou!&quo=
t;;<br>
 =
; }<br>
?><br>
<br>
</blockquote></div><br><br clear=3D"all"><br>-- <br>Att,<br>Rafael Proc=F3pi=
o Vale<br>51 - 3037-2276<br><a href=3D"http://www.infoccus.com.br">www.infoc=
cus.com.br</a>
------=_Part_4298_3045178.1210872173250--