$mime .= "Content-type: application/octet-stream;\r\n";
$mime .= "Content-type: application/octet-stream; name=\"$attach_name\"\r\n";

-----Original Message-----
From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 16, 2002 2:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP] attachment filename


The code below very nicely sends an email attachment, but, the name of
the attachment appears as "Part.000," not the original filename of the
attached file.

How do I set the filename of the attachment?  I'd like it to be
something nice, like "yourfileattachment.txt" or something, not
"Part.000."  What is Part.000 anyway?

Stumped!

Help!

Thanks!

Code:

//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.dmp";
                        $attach = chunk_split(base64_encode(implode("",
file($filename))));
                        $mime .="--$boundary\r\n";
                        $mime .="Content-type:
application/octet-stream;\r\n";
                        $mime .="Content-Disposition: attachment\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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to