Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting size of IMAP mailbox

10 views
Skip to first unread message

Adam Witney

unread,
May 27, 2003, 1:49:52 PM5/27/03
to MacOS X perl

Our sysadmins have decided to put a quota on the size of our email
mailboxes. They have implemented a 'function' to warn the user when he gets
close to the limit... However they have only implemented this function for
windows mail clients!

I was wondering if there was anything I could do in perl to be able to
connect to the IMAP server and report back the size of my mailbox?

I have had a quick look through Mail-IMAPClient and Net-IMAP-Simple, but
didn't see anything in there that would do what I wanted

Any ideas of how I might think about doing this? If indeed it is possible?

Thanks for any help or pointers

adam


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Trey Harris

unread,
May 27, 2003, 2:05:33 PM5/27/03
to Adam Witney, MacOS X perl
In a message dated Tue, 27 May 2003, Adam Witney writes:
> Our sysadmins have decided to put a quota on the size of our email
> mailboxes. They have implemented a 'function' to warn the user when he gets
> close to the limit... However they have only implemented this function for
> windows mail clients!
>
> I was wondering if there was anything I could do in perl to be able to
> connect to the IMAP server and report back the size of my mailbox?
>
> I have had a quick look through Mail-IMAPClient and Net-IMAP-Simple, but
> didn't see anything in there that would do what I wanted
>
> Any ideas of how I might think about doing this? If indeed it is possible?

Yay, a question on this list I can answer. That happens so rarely. Of
course, this is completely OT for this list, so maybe that's why... :-)

RFC 2087 defines the quota extension for IMAP:

http://www.faqs.org/rfcs/rfc2087.html

The problem is that your sysadmins may not be using an IMAP server which
implements quotas--instead they may be using filesystem quotas on the mail
spool as a dodge. (This is exceedingly bad practice, btw, for reasons I
can go into if you're interested, but I was on the original IETF IMAP4rev1
working group, so I may be biased. :-)

It is very easy to determine by hand, before you spend any time coding,
which mechanism they're using (The lines starting with '>>>' represent
what you type, but you don't type the '>>>'):

% telnet <yourmailserver> imap
>>> 000 LOGIN <yourusername> "<yourpassword>"
000 OK [CAPABILITY IMAP4REV1 IDLE NAMESPACE MAILBOX-REFERRALS SCAN SORT
THREAD=REFERENCES THREAD=ORDEREDSUBJECT MULTIAPPEND QUOTA] User
<yourusername> authenticated
>>> 001 GETQUOTA ""

To the GETQUOTA command, you will receive either an OK, NO, or BAD. If
you get either OK or NO, it means that IMAP quotas are enabled. If you
get BAD, then it means they aren't.

If they aren't, you'll have to find out what the Windows client does and
reverse engineer it. Or maybe just ask your sysadmins--most of us are
willing to work with users when their requests are reasonable. (But then
again, in my personal experience, sysadmins who implement solutions using
Windows are less likely to be generally reasonable people. ;-)

Trey
--
Trey Harris
Vice President
SAGE -- The System Administrators Guild (www.sage.org)
Opinions above are not necessarily those of SAGE.

Sherm Pendley

unread,
May 27, 2003, 2:45:09 PM5/27/03
to Trey Harris, Adam Witney, MacOS X perl
On Tuesday, May 27, 2003, at 02:05 PM, Trey Harris wrote:

> Yay, a question on this list I can answer. That happens so rarely. Of
> course, this is completely OT for this list, so maybe that's why... :-)
>
> RFC 2087 defines the quota extension for IMAP:

The Net::IMAP module appears to support this extension.

But, I haven't used that module. It's at version 0.02, and it didn't
build and test cleanly for me using 5.6.0. Even so, it may be worth a
look.

sherm--

C programmers never die - they're just cast into void.

0 new messages