|
-
Aug 22nd, 2004, 10:33 AM
#1
Thread Starter
Addicted Member
Directory Size / Inbox Size
How can i get the size of a directory (without subdirs) in php
also how can i do this with an email inbox ?
thanks people
-
Aug 24th, 2004, 01:14 PM
#2
<?="Moderator"?>
are you try to get the Inbox size of a pop3 account?
-
Aug 24th, 2004, 02:22 PM
#3
Thread Starter
Addicted Member
yeah ive sorted the other issue by just looping through the files
-
Aug 24th, 2004, 02:39 PM
#4
<?="Moderator"?>
I started a script to download emails from a POP3 server, ill just try and dig it out for you.
-
Aug 24th, 2004, 03:18 PM
#5
<?="Moderator"?>
PHP Code:
<?
header('Content-Type: Text/plain');
$server = "mail.domain.co.uk";//server address
$username = "[email protected]";//username
$password = "password";//password
$fp = fsockopen($server,110,$errno,$errdesc);
//open connection to POP3 server
if($fp){
$welcome = fgets($fp,150);
//wait for welcome message from server
if(substr($welcome,0,3)=="+OK"){ // check that the response is ok
fputs($fp,"USER $username\r\n"); //send your username
fgets($fp,1024); //wait for the response can check this
//repsonse for extra validity
fputs($fp,"PASS $password\r\n");//send password
$ack = fgets($fp,1024); //get response on state
if(substr($ack,0,3)=="+OK"){ //check to see if user && pass are correct
print "Login OK\n";
fputs($fp,"STAT\r\n"); //ask for the stats of the mailbox
$output = fgets($fp,1024);
$output = split(" ",$output);//split the response into useful inforation
//resonse looks like +OK 1 200
// first number mail count
//second number mailbox size
print "Messages:\t\t{$output[1]}\n";//display message count
print "MailBox Size:\t\t{$output[2]}\n";//display mail box size
}else{
print "Failed: $ack\n";
}
}else{
print "Failed: $welcome\n";
}
}
?>
Hope that helps
-
Aug 24th, 2004, 11:25 PM
#6
For POP3 the STAT command returns two numbers. The first is the number of messages in the mailbox and the second is the total size of all the messages.
You can also use LIST to return the size of individual messages.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|