The following describes how to use php to calculate the mail size. For more information, see
The following describes how to use php to calculate the mail size. For more information, see
Count the space occupied by the user's inbox. For the Hong Kong virtual host, calculate the size of each email (Title + content + nearby), the Hong Kong server, and the total;
1. Calculate the nearby size;
2. Calculate the title and content size
3. Calculate the total size of a single email.
Case:
The Code is as follows:
$ Attach_size = 0;
If ($ attachmentid) {// obtain the nearby size
$ Attach_data = attachdata ($ attachmentid );
If ($ attach_data ){
Foreach ($ attach_dataas $ value ){
$ Attach_size + = $ value ['filesize'];
}
}
}
// Obtain the title and email content size
$ 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 mail size
?>
, Hong Kong VM