Re: MSWord attachment with mail() (III)

From: Date: Tue, 24 Jun 2003 21:39:08 +0000
Subject: Re: MSWord attachment with mail() (III)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-152666@lists.php.net to get a copy of this message
throw file content in $filedata $filedata = chunk_split(base64_encode($filedata)); $type = "application/octet-stream"; $encoding = "base64";
    mt_srand((double)microtime()*1000000);
    $boundary = '--b'.md5(uniqid(mt_rand())) . getmypid();
    $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: application/msword\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";

« previous php.general (#152666) next »