Connect. Communicate. Collaborate. Securely.

Home » Kerio User Forums » Kerio Connect » [PHP] getquota in script
  •  
Simple

Messages: 50
Karma: 0
Send a private message to this user
I am developing an intranet site for our company. On this page I want to show the mailbox size en quota for the current user.

- Kerio MailServer 6.3.1
- Microsoft IIS 5.0 and PHP 5.2.2

Example from PHP.net:
<?php
$mbox = imap_open("{imap.example.org}", "mailadmin", "password", OP_HALFOPEN)or die("can't connect: " . imap_last_error());

$quota_value = imap_get_quota($mbox, "user.kalowsky");
if (is_array($quota_value)) {
    echo "Usage level is: " . $quota_value['usage'];
    echo "Limit level is: " . $quota_value['limit'];
}
imap_close($mbox);
?>


The error that I get is the following:

Warning: imap_get_quota() [function.imap-get-quota]: c-client imap_getquota failed in F:\Inetpub\wwwroot\dev\imap\quota.php on line 13
Notice: Unknown: GETQUOTA Permission denied (errflg=2) in Unknown on line 0

The imap_get_quotaroot function works, but I want to use imap_get_quota.

Another solution is read out the Active Directory, with PHP I can print the mail and storage quota, but the current usage is not available in Active Directory. Could anybody tell me how to handle with this problem?

[Updated on: Fri, 04 May 2007 11:01]

  •  
Simple

Messages: 50
Karma: 0
Send a private message to this user
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
There's no published API to KMS< so there's no way to get this info directly... Through IMAP should work (and does work for example when using the 'Display Quota' plugin in Thunderbird).

I guess there's a bug in PHP or in your code...
  •  
Simple

Messages: 50
Karma: 0
Send a private message to this user
There is no fault in the PHP script, it's a direct copy/paste from the php.net website. Of course I used it with my own variables.

The problem is, imap_get_quota_root works. But imap_get_quota not.
Imap_get_quota works with an administrator account. I don't want the users to fill in their credentials everytime the access the intranet page.
  •  
osci

Messages: 47
Karma: 0
Send a private message to this user
Simple wrote on Thu, 10 May 2007 15:00

There is no fault in the PHP script, it's a direct copy/paste from the php.net website. Of course I used it with my own variables.

The problem is, imap_get_quota_root works. But imap_get_quota not.
Imap_get_quota works with an administrator account. I don't want the users to fill in their credentials everytime the access the intranet page.


How do you check the quota in that case ? You have to give credentials for an IMAP login, be it the admin or the user login.

You can always use a packet sniffer (something like tcpflow) to see what an IMAP client is sending to KMS to get the quota.

And did you check in your KMS logs (especially the security one) to see if you have a better error message ?
  •  
osci

Messages: 47
Karma: 0
Send a private message to this user
And the lack of a official API is really a PITA. I have to use the IMAPFullListing feature of KMS with JavaMail to be able to get data out of KMS.
  •  
Simple

Messages: 50
Karma: 0
Send a private message to this user
Could anyone tell me where Kerio is store the current user usage of storage and items ?
  •  
winkelman

Messages: 2119
Karma: 3
Send a private message to this user
In a stats.usr file in the users store folder (each user has her/her own stats.usr file). But it's not in a readable (plain-text) format...
  •  
campodoro74

Messages: 119
Karma: 0
Send a private message to this user
The format is in Motorola S-Record, a format to store binary data in ASCII format. See http://www.die.net/doc/linux/man/man5/srec.5.html.
  •  
Pavel Dobry (Kerio)

Messages: 5245
Karma: 251
Send a private message to this user
No, it isn't. It's a simple text file with proprietary format.
  •  
Simple

Messages: 50
Karma: 0
Send a private message to this user
Hmm.. Could you tell me how to get this to a more readable format?
  •  
Simple

Messages: 50
Karma: 0
Send a private message to this user
*Kick again*

Please Kerio make an api for this!!
Previous Topic: AD extensions, special reply to not syncing.
Next Topic: Login with URL-Parameter via PDA/Cellphone?
Goto Forum:
  


Disclaimer:
Kerio discussion forums are intended for open communication between forum members and may contain information and material posted by members which may be useful in learning about Kerio products. The discussion forums are not intended to provide technical support for any specific product. Any information implied or expressed in the discussion forums is that of the posting member. Kerio is in no way responsible for the information posted in the forums, or its accuracy. Kerio employees may participate in the discussions, but their postings do not represent an offical position of the company on any issues raised or discussed. Kerio reserves the right to monitor and maintain the forums to promote free and accurate exchange of information.

Current Time: Tue Nov 21 13:03:20 CET 2017

Total time taken to generate the page: 0.00459 seconds
.:: Contact :: Home ::.
Powered by: FUDforum 3.0.4.