//統計用戶收件箱所占空間有多少,先計算每封郵件的大小(標題+內容+附近),後總和; //1、計算附近大小; //2、計算標題和內容大小 //3、總和求出單封郵件大小 eg: [php] <?php $attach_size= 0; if($attachmentid){ //獲取附近的大小 $attach_data= attachdata($attachmentid); if($attach_data){ foreach($attach_dataas$value) { $attach_size+= $value['filesize']; } } } //獲取標題和郵件內容的大小 $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; //郵件總大小 ?>