RE: [PHP] Email Attachment

From: Date: Sat, 02 Feb 2002 00:12:25 +0000
Subject: RE: [PHP] Email Attachment
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-83222@lists.php.net to get a copy of this message
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: automailer@fritzz.com\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 = "frank@es.nl"; //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:sthandier@yahoo.com] Verzonden: vrijdag 1 februari 2002 20:45 Aan: php-general@lists.php.net 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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#83222) next »