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 = '[EMAIL PROTECTED]';
                        
                        $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

Reply via email to