search
Homephp教程php手册php:统计邮件的大小方法

php:统计邮件的大小方法

Jun 13, 2016 am 10:54 AM
phpcontentHow manysizeinboxmethodtitleuserofstatisticscalculatemail

//统计用户收件箱所占空间有多少,先计算每封邮件的大小(标题+内容+附近),后总和;

//1、计算附近大小;

//2、计算标题和内容大小

//3、总和求出单封邮件大小

eg:

[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;  //邮件总大小             

?>  

 

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use