Word2000 .doc as email attachment

From: Date: Fri, 09 Mar 2001 16:20:22 +0000
Subject: Word2000 .doc as email attachment
Groups: php.general 
Request: Send a blank email to php-general+get-43168@lists.php.net to get a copy of this message
anyone having trouble with these files getting mangled in transport? i'm using the email class from renaghan's phpop. i'm wondering if the base64 encoding might be horking things? function formatAttachmentHeader($inFileLocation, $inNiceFileName){ $outAttachmentHeader = ""; //--get content type based on file extension $contentType = $this->getContentType($inNiceFileName); //--get contents of attachment file $aFile = fopen($inFileLocation,"rb"); $aFileContents = fread($aFile, 2000000); fclose($aFile); //--if content type is TEXT the standard 7bit encoding if(ereg("text",$contentType)){ //--format header $outAttachmentHeader .= "Content-Type: ".$contentType.";\n"; $outAttachmentHeader .= ' name="'.basename($inNiceFileName).'"'."\n"; $outAttachmentHeader .= "Content-Transfer-Encoding: 7bit\n"; $outAttachmentHeader .= "Content-Disposition: inline;\n"; //--other: inline $outAttachmentHeader .= ' filename="'.basename($inNiceFileName).'"'."\n\n"; $outAttachmentHeader .= $aFileContents."\n"; } //--NON-TEXT use 64-bit encoding else{ //--format header $outAttachmentHeader .= "Content-Type: ".$contentType.";\n"; $outAttachmentHeader .= ' name="'.basename($inNiceFileName).'"'."\n"; $outAttachmentHeader .= "Content-Transfer-Encoding: base64\n"; $outAttachmentHeader .= "Content-Disposition: attachment;\n"; //--other: inline $outAttachmentHeader .= ' filename="'.basename($inNiceFileName).'"'."\n\n"; $outAttachmentHeader .= chunk_split (base64_encode($aFileContents)); $outAttachmentHeader .= "\n"; } return $outAttachmentHeader; }

« previous php.general (#43168) next »