[imp] Total size mailbox

Tim Gorter email at teletechnics.com
Fri Aug 15 11:12:50 PDT 2003


Hi Richard,

As you may have noticed there are quite a few options etc. that you
need to configure.

So if you want this community to help you, you are going to have to
supply a lot more information. The quota information has to come from
somewhere, so you have to be clear as to where you are going to get it
from.

ie. for me as my imap server does not directly supply it, I actually
get it out of the messages log, where the imap login gives me the
info.

So, you will firstly have to supply the community here with a lot more
information if you want any help, ie. what O/S, imap server, php
version etc. etc. Then you will have to do a little footwork and
figure out what on your server will actually supply the quota info you
want to reproduce.

Then in the conf. file a function has to be written/adjusted that
extracts that info for you.

all the best,
tim.

Friday, August 15, 2003, 5:03:42 PM, Hobbs, Richard wrote:

HR> Hello,

HR> OK... i enabled the quota stuff, but i'm getting an error on each page...

HR> Warning: imap_close(): supplied argument is not a valid imap resource in
HR> /hsphere/local/home/fishspon/webmail.mongeese.co.uk/horde/imp/config/conf.php on
HR> line 399

HR> Here's what i have in conf.php:

HR> ======================================================================

HR> // If this is set to a function name, that function will be used
HR> // to show the user's quota usage on the mailbox page.
HR> // See the 'imp_show_quota' function below for an example.
HR> $conf['hooks']['quota'] = 'imp_show_quota';

HR> /* Gets the quota usage from the imap server. $imap_admin &
HR>  * $imap_passwd must be set to fit your own settings. This works
HR>  * with the Cyrus imap server and the Courier imap server > 1.3.12. 
HR>  * Note the necessary changes for the Courier server in the comments.
HR>  */
HR> if (!function_exists('imp_show_quota')) {
HR>    function imp_show_quota ($imp) {
HR>         $quota_html = '';
HR>         $imap_admin = 'admin';
HR>         $imap_passwd = 'password';   
HR>         // Use the following two lines instead for Courier.
HR>         // $imap_admin = $imp['user'];
HR>         // $imap_passwd = Secret::read(Secret::getKey('imp'), $imp['pass']);

HR>         $stream = @imap_open(IMP::serverString(), $imap_admin, $imap_passwd,
HR> OP_HALFOPEN);
HR>         $quota = @imap_get_quota($stream, 'user.' . $imp['user']);
HR>         // Use the following line instead for Courier.
HR>         // $quota = @imap_get_quota($stream, 'ROOT');
HR>         imap_close($stream);

HR>         if (is_array($quota) && $quota['limit'] != 0) {
HR>             $taken   = $quota['usage'] / 1024.0;
HR>             $total   = $quota['limit'] / 1024.0;
HR>             $percent = $taken * 100 / $total;
HR>             if ($percent >= 90) {
HR>                 $class = 'quotaalert';
HR>             } elseif ($percent >= 75) {
HR>                 $class = 'quotawarn';
HR>             } else {
HR>                 $class = 'control';
HR>             }

HR>             $quota_html = '<table width="100%" border="0" cellpadding="0"
cellspacing="0">><tr><td class="item">'
HR>                           . '<table border="0" cellspacing="2" cellpadding="2"
width="100%">><tr><td align="center" class="' . $class . '">'
HR>                           . sprintf("%.2fMB / %.2fMB  (%.2f%%)", $taken, $total,
HR> $percent)
HR>                           . '</td></tr></table></td></tr></table>';
HR>         }
HR>         return $quota_html;
HR>     }
HR> }

HR> ======================================================================

HR> Any ideas??

HR> Thanks,
HR> Hobbs.


HR> Quoting "Hobbs, Richard" <hobbs at mongeese.co.uk>:

>> Hello,
>> 
>> I read the docs and i've found the settings, but i can't figure something
>> out...
>> 
>> it says:
>> 
>> > // If this is set to a function name, that function will be used
>> > // to show the user's quota usage on the mailbox page.
>> > // See the 'imp_show_quota' function below for an example.
>> > $conf['hooks']['quota'] = '';
>> 
>> Does this need to be the command that's actually sent to the IMAP server
>> then??
>> 
>> > /* Gets the quota usage from the imap server. $imap_admin &
>> >  * $imap_passwd must be set to fit your own settings. This works
>> >  * with the Cyrus imap server and the Courier imap server > 1.3.12.
>> >  * Note the necessary changes for the Courier server in the comments.
>> >  */
>> > // if (!function_exists('imp_show_quota')) {
>> > //    function imp_show_quota ($imp) {
>> > //         $quota_html = '';
>> >> <<<<< snip >>>>>
>> 
>> if the "imp_show_quota" function exists... i assume this will exist as soon
>> as i
>> fill in the first one, right??
>> 
>> i never grasped this whole coding thing unfortunately...
>> 
>> thanks for ur help ppl :-)
>> 
>> Hobbs.
>> 
>> 
>> Quoting Jan Schneider <jan at horde.org>:
>> 
>> > Zitat von "Hobbs, Richard" <hobbs at mongeese.co.uk>:
>> > 
>> > > Hello,
>> > >
>> > > Is it a module to install?
>> > 
>> > No.
>> > 
>> > >  |
>> > >  |- if so... what's it called?
>> > >  |
>> > >  |- if not... how do i enable it?
>> > 
>> > Read the docs and config files.
>> > 
>> > Jan.
>> > 
>> > --
>> > http://www.horde.org - The Horde Project
>> > http://www.ammma.de - discover your knowledge
>> > http://www.tip4all.de - Deine private Tippgemeinschaft
>> > 
>> 
>> 
>> -- 
>>   _-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_
>>   |                                                                |
>>   | Richard Hobbs    hobbs at mongeese.co.uk    http://mongeese.co.uk |
>>   |                                         http://unixforum.co.uk |
>>   |----------------------------------------------------------------|
>>   | Registered Linux User: 313906          (http://counter.li.org) |
>>   |----------------------------------------------------------------|
>>   | "There's only one way of life, and that's your own"            |
>>   |                                                  The Levellers |
>>   '`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'
>> 
>> ______________________________________________________________________
>> Send all your jokes to : jokes at fishsponge.co.uk !!
>> To subscribe, email    : jokes-subscribe at fishsponge.co.uk
>> 
>> -- 
>> IMP mailing list
>> Frequently Asked Questions: http://horde.org/faq/
>> To unsubscribe, mail: imp-unsubscribe at lists.horde.org
>> 


HR> -- 
HR>   _-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_
HR>   |                                                                |
HR>   | Richard Hobbs    hobbs at mongeese.co.uk    http://mongeese.co.uk |
HR>   |                                         http://unixforum.co.uk |
HR>   |----------------------------------------------------------------|
HR>   | Registered Linux User: 313906          (http://counter.li.org) |
HR>   |----------------------------------------------------------------|
HR>   | "There's only one way of life, and that's your own"            |
HR>   |                                                  The Levellers |
HR>   '`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'`-_-'

HR> ______________________________________________________________________
HR> Send all your jokes to : jokes at fishsponge.co.uk !!
HR> To subscribe, email    : jokes-subscribe at fishsponge.co.uk



---------------------------------------------------
Teletechnics Afield
Tel +34 65 22 60 777 Fax +34 63 73 01 920
mailto:email at teletechnics.com   http://www.teletechnics.com

currently in: Barceloneta, Spain



More information about the imp mailing list