> 
> How to count up the quota information for the user through IMAP
commands
> or MySQL?
> 

A high level procedure for database only to calculate quota:

Assume you have a connection context with the dbmail database.
1. Query the users table to get the quota value in maxmail_size for a
specific user and store the user_idnr around in a variable for use in
the next step.
2. Query the messageblk table where messageblk_idnr = user_idnr and sum
the blocksize field for all messages returned for a particular user.
That should yield you a total bytes stored for a single mailbox.
3. Compare summed bytes against maxmail_size bytes however you desire.

For example, you could calculate percent full with (summed_value /
maxmail_size)*100 and warn the user with a email at a particular
percentage (say 95%) before the quota is completely filled.  Or just
display a percentage on a webmail interface or whatever...

Regards,
Dave


 

Reply via email to