Is it possible to send attachments via mail() function?
I tried it, and it didn't work out... the email I receive is all messed up,
and even the simple text part of it is screwed up. I now very little about
MIME, but I really need to send an attachment, any help? It's a text
attachment...
This is the code I'm using:
function send_email($body,$num_pedido,$filename)
{
define(NL,"\n");
$boundary="test".chr(rand(65,91))."----".md5(uniqid(rand()));
$message="Segue em anexo dados referentes ao pedido $num_pedido.".NL.NL;
$message="Content-type: text/plain\nContent-transfer-encoding:
7bit".NL.NL.$message;
$attach="Content-type: text/plain\nContent-transfer-encoding:
base64\nContent-disposition: attachment; filename=".$filename.NL.NL;
$attach.=base64_encode($body);
$attach.=NL;
$mail_body=$boundary.NL.$message.$boundary.NL.$attach.$boundary."-";
$header="MIME-Version: 1.0\nContent-Type:
multipart/mixed;\n\tboundary=\"".$boundary."\"\nContent-Transfer-Encoding:
7bit";
// echo "<pre>$mail_body</pre>";
mail("[EMAIL PROTECTED]","CDYOU Pedido:
".$num_pedido,$mail_body,$header);
}
the headers are sent perfectly... and if I echo the $mail_body (I think)
it's correct, but when I get the mail it's all screwed up...
thanks...
_________________________________
. Christian Dechery - CTO
.. WebDeveloper @ Webstyle!
.. http://www.webstyle.com.br
.. http://www.tanamesa.com.br
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]