This should do the trick, experiment wit hit;

function mail_attachment($email, $buffer)
 {
//subject 
$subject = "Testing pdf attachment.."
//sender
$x_sender = "F. Hertogs";
//extra (optional) headers
$x_headers = "From: [EMAIL PROTECTED]\n";
$x_headers .= "PHP mailer\n";
$x_headers .= "MIME-version: 1.0\n";
//tell mail program it's multipart/mixed
$x_headers .= "Content-type: multipart/mixed; "; 
//tell mail program what boundary looks like
$x_headers .= "boundary=\"Message-Boundary\"\n";
//encoding
$x_headers .= "Content-transfer-encoding: 7BIT\n";
//to prevent error in case email is empty (I only use this for testing 
//normally; use php or javascript to check forms before submitting
if(!IsSet($email))
 $email = "[EMAIL PROTECTED]";
//first boundary
$body = "--Message-Boundary\n";
//start text message
$body .= "Content-type: text/plain; charset=US-ASCII\n";
$body .= "Content-transfer-encoding: 7BIT\n";
$body .= "Content-description: Mail message body\n\n";
//text for message
$body .= "Dear sir,\n\nHere is the requested file blabla"
//end text message
$body .= "\n\n--Message-Boundary\n";
//start application pdf in this example
$body .= "Content-type: application/pdf name=\"attach.pdf\"\n"; 
$body .= "Content-Transfer-Encoding: base64\n";
$body .= "Content-disposition: attachment; filename=\"attach.pdf\"\n\n";
$enc_pdf = chunk_split(base64_encode($buffer));
$body .= $enc_pdf . "\n"; }
$body .= "--Message-Boundary--\n";
//mail actual message
mail($email, $subject, $body, $x_headers);
}

I hope this helps you.

Frank. 

-----Oorspronkelijk bericht-----
Van: Mauricio Sthandier [mailto:[EMAIL PROTECTED]] 
Verzonden: vrijdag 1 februari 2002 20:45
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] Email Attachment

Hello, I'm new in php development... I was wondering how can I attach a
Word
(.doc) Document in an email sent with the mail() function (if I can do
it
just with it).

I know it has to see with the additional headers of the email, but I
would
be grateful If anyone could tell where can i go to for this specific
information.

I couldn't find it in PHP manual (.pdf version).

Thanxs !




-- 
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]



-- 
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]

Reply via email to