Count the amount of space the user Inbox, first calculate the size of each message (title + content + nearby), after the sum;
1, calculate the nearby size;
2. Calculate title and content size
3, sum to find a single message size
Case:
Copy CodeThe code is as follows:
$attach _size= 0;
if ($attachmentid) {//Get the size nearby
$attach _data= Attachdata ($attachmentid);
if ($attach _data) {
foreach ($attach _dataas$value) {
$attach _size+= $value [' filesize '];
}
}
}
Get the title and the size of the message content
$email _content_size= 0;
$_filename= "Attachment/emailsizecalculate.tmp";
$_file= fopen ($_filename, "WB");
Fwrite ($_file, $subject. $content);
Fclose ($_file);
if ($_temp= filesize ($_filename)) {
$email _content_size= $_temp;
}
$del _ret= @unlink ($_filename);
$sum _size= $attach _size*1024 + $email _content_size; Total message size
?>
http://www.bkjia.com/PHPjc/328075.html www.bkjia.com true http://www.bkjia.com/PHPjc/328075.html techarticle Count the amount of space the user Inbox, first calculate the size of each message (title + content + near), after the sum, 1, calculate the vicinity size, 2, calculate the title and content size 3, total ...