Re: email attachments

From: Date: Wed, 17 Apr 2002 07:13:07 +0000
Subject: Re: email attachments
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-93299@lists.php.net to get a copy of this message
use PEAR::Mail(); it has all you need. "James E. Hicks III" <jameshicks@noland.com> schrieb im Newsbeitrag news:HKEMKMHAGEDFEDCGPGOFMECFELAA.jameshicks@noland.com... > You need a Content-Disposition in yer $mime variable. I'll leave it up to you to > figure out where, because I've forgotten where it goes exactly. > > James > > > -----Original Message----- > From: ROBERT MCPEAK [mailto:RMCPEAK@jhuccp.org] > Sent: Tuesday, April 16, 2002 8:46 AM > To: php-general@lists.php.net > Subject: [PHP] email attachments > > > This nifty code (taken from PHP Cookbook) sends an email with a file > "attached" in-line. The text from the attached file appears within the > body of the email. I need to send attached files that are not in-line, > but, rather, come as attached files that the user views outside of their > email browser. Can somebody help me with this. Maybe tweak the code > I've got? > > Thanks! > > //attachment > $to = $the_email; > $subject = 'dump'; > $message = 'this is the dump'; > $email = 'rmcpeak@jhuccp.org'; > > $boundary ="b" . md5(uniqid(time())); > $mime = "Content-type: multipart/mixed; "; > $mime .= "boundary = $boundary\r\n\r\n"; > $mime .= "This is a MIME encoded > message.\r\n\r\n"; > //first reg message > $mime_message .="--$boundary\r\n"; > $mime .="Content-type: text/plain\r\n"; > $mime .="Content-Transfer-Encoding: base64"; > $mime .="\r\n\r\n" . > chunk_split(base64_encode($message)) . "\r\n"; > //now attach > $filename = "mysqldump/surveydump.txt"; > $attach = chunk_split(base64_encode(implode("", > file($filename)))); > $mime .="--$boundary\r\n"; > $mime .="Content-type: text/plain\r\n"; > $mime .="Content-Transfer-Encoding: base64"; > $mime .="\r\n\r\n$attach\r\n"; > > > > > > > mail($to, > $subject, > "", > $mime); > > > > //attachment > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#93299) next »