Home  >  Article  >  Backend Development  >  PHP: How to count the size of emails_PHP tutorial

PHP: How to count the size of emails_PHP tutorial

WBOY
WBOYOriginal
2016-07-14 10:08:051225browse

//To count the space occupied by the user's inbox, first calculate the size of each email (title + content + vicinity), and then add the total;

//1. Calculate nearby size;
///2. Calculate title and content size
///3. Calculate the total size of a single email
eg:
[php]
$attach_size= 0;
if($attachmentid){ //Get nearby size
$attach_data= attachdata($attachmentid);
if($attach_data){
foreach($attach_dataas$value) {
$attach_size+= $value['filesize'];
                                                                   
} }
}  
//Get the size of the title and email 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 email size                                      
?>

http://www.bkjia.com/PHPjc/477814.html

truehttp: //www.bkjia.com/PHPjc/477814.htmlTechArticle//To count how much space a user’s inbox takes up, first calculate the size of each email (title + content + nearby), then sum; //1. Calculate nearby size; //2. Calculate title and content size...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn