hi well actually I know what is the mechanism of sending mime messages with atttachments works, the problem is that I don't know how to to read attachment. I tried to use Pear decode functions but it only gives me info that there are attachments in the message which is obviosly not enough.
so I'm putting my question once again: how to read attachment from the mime message and how to save it on client hard drive??? thanks for any help brtek Uzytkownik "Chris Hayes" <[EMAIL PROTECTED]> wrote > At 11:11 31-1-2003, you wrote: > >hi all > > > > I'm writing a mail client and I got problem with attachments. I have no > >idea how to read and save attachments. Mayby someone already did something > >like that a can help me with some advice or giving me link to some > >resourses. > Maybe it helps to see how an attachment is send, then you can try to > reverse the process to read in attachments. > > > assume that $filedata holds the data you want to attach > the encoding can done in many ways, so read the headers carefully > > //prepare mail body > $filedata = chunk_split(base64_encode($filedata)); > $type = "application/octet-stream"; > $encoding = "base64"; > mt_srand((double)microtime()*1000000); > $boundary = '--b'.md5(uniqid(mt_rand())) . getmypid(); //so the > boundary line can be quite diverse > $mailbody = "From: PHP backup script by Arakrys\n" > ."MIME-Version: 1.0\n" > ."Content-Type: multipart/mixed; " > ."boundary=\"$boundary\"\n\n" > ."This is a MIME encoded message. \n\n" > ."--$boundary\n" > ."Content-Type: text/plain"; > //if ($this->charset != "") $mailbody .= "; charset=$this->charset"; > $mailbody .="\n" > ."Content-Transfer-Encoding: 8bit\n\n" > .$message . "\n\n\n--$boundary"; > $data = "Content-Type: $type"."; name = \"$filename\"" > ."\n" ."Content-Transfer-Encoding: $encoding" > ."\n\n$filedata\n"; > $mailbody .= "\n$data\n--$boundary" > ."--\n"; > > //send mail > mail($mailto, $MYSQL_DB.' database backup '.date("d M Y H:i"), ' ', > $mailbody) or die ('Could not send email!'); > } > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php