[Dovecot] Quota plugin and SQL

Leonardo Rodrigues leolistas at solutti.com.br
Sun Mar 7 13:34:30 EET 2010

Em 06/03/2010 19:12, David escreveu:
> Is there any way to modify the queries used to split out username into 
> localpart and domain?  This would enable me to put the current quota 
> information in my main mailbox table and display it to users in my 
> admin interface.

     i'm successfully using a PHP script for displaying a graph with 
current quota information in my admin interface. Is this what you're 
looking for ? Quota usage is taken directly from IMAP server, through 
IMAP commands.


     i'm actually using a script based on the one found here:


     the original script grabs the current usage from database, and i 
dont have the information there. So i changed it to use imap_open and 
grab quota directly from IMAP server. Something like:

Changes would be something like:

function draw_bar($mailbox, $width, $height) {
     global $imaphost, $usuario, $senha;
     $mbox = @imap_open($imaphost, $usuario, $senha, OP_HALFOPEN);
     $q = @imap_get_quotaroot($mbox, 'INBOX');
     if ($q) {
         $taken = $q['usage'];
         $total = $q['limit'];
         quota_bar($taken, $total, $width, $height);

     that's pretty straightforward when your passwords are stored in 
clear-text. In my cases password is SSHA256-hashed before storing, so i 
had to configure a masteruse on dovecot to acchieve that.


     so i have something:

$user = $realuser . "*mymasteruser at local"
$password = "mypasteruserpassword"


	Atenciosamente / Sincerily,
	Leonardo Rodrigues
	Solutti Tecnologia

	Minha armadilha de SPAM, NÃO mandem email
	gertrudes at solutti.com.br
	My SPAMTRAP, do not email it

More information about the dovecot mailing list