RE: [PHP] attachment filename

From: Date: Tue, 16 Apr 2002 19:46:44 +0000
Subject: RE: [PHP] attachment filename
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-93246@lists.php.net to get a copy of this message
$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:RMCPEAK@jhuccp.org] Sent: Tuesday, April 16, 2002 2:45 PM To: php-general@lists.php.net 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 = '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.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

« previous php.general (#93246) next »