how to generate a warning when email quota exceeded in Quota type soft

7 posts / 0 new
Last post
#1 Wed, 08/26/2009 - 01:43
ming1340

how to generate a warning when email quota exceeded in Quota type soft

Hi all , i am using Cent 0S 5.2 ,

When i using Quota type hard , when the quota exceed , the new mail can't sent in.

after i change the type to soft.... i perfer their a wrong message sent out ,but can't .

Where can i setup to " generate a warning when exceeded " ?

Thank a lot and waiting for reply.

Wed, 08/26/2009 - 02:39
ming1340

No one can help me ?

As i need upgrade to Virtualmin Pro ?

Wed, 08/26/2009 - 07:40
andreychek

We'll gladly lend a hand, but you asked when most folks here in the US are asleep :-)

You can enable notification messages in Disk Quota Monitoring -> Limits and Validation.

From there, you can select when warning messages should go out, how frequently, as well as the contents of the message (amongst other things!).

-Eric

Thu, 08/27/2009 - 05:17
ming1340

Eric ,

I am gladly to hear your replay.

But i can't find the Disk Quota Monitoring in my Virtualmin ?

my Virtualmin version 3.70.gpl GPL .

Is it have this function ?

Is it need to upgrade to Pro , if i want to enable the Disk Quota Monitoring ?

Thu, 08/27/2009 - 09:44
andreychek

Well, hrm.

I tend to really lose track of what is GPL and what is Pro :-)

I'm sure quotas are available in the GPL version, but it's possible quota notifications are only in the Pro version.

Also, it looks like you're a couple of versions behind, you might consider popping 3.72 on there, but I don't think that's the problem.

I'll fire up my VMware instance so I can take a look at the GPL version here quick...

(some time later)

Okay, yeah, looks like you're right -- the quota notification seems to be a Pro-only feature.

So, you can use disk quotas in the GPL version -- but the notifications are only in Pro.

If you do any programming, you could always create a cron job to do that for you.

For example, the Virtualmin API is still available to you -- you could run "virtualmin list-domains", and then loop over that output, grab the domain name, and run "virtualmin list-users" on the results.

Finally, you could loop over the list-users output, and run "quota -v USERNAME" on each user.

Of course, using the Pro version might be simpler, but the above is an alternative :-)

-Eric

Fri, 08/28/2009 - 02:39
ming1340

thx a lot....

i am only a newbit of linux server ....

So ..maybe can't using the command to generate a report .

But all of them , Thank very much...

Thu, 07/22/2010 - 04:54
makoka

Dear all.

I was also wonder how could I notify e-mail users only about their quota limits.
After lot of reading got one solution (currently I'm just configuring it and it is not yet production).

But let me share with you my ideas.
I've got Virtualmin GPL on Centos 5.4.
All my e-mail users are system users (not virtual). So every mail user has it home directory where Maildir is stored.

Postfix and Dovecot support Maildir++ format.

http://wiki.dovecot.org/Quota
# fs: Filesystem quota.
# dirsize: The simplest and slowest quota backend, but it works quite well with mboxes.
# dict: Store quota usage in a dictionary (e.g. SQL).
# maildir: Store quota usage in Maildir++ maildirsize files. This is the most commonly used quota for virtual users.

Quota plugin for Dovecot should be enabled (http://wiki.dovecot.org/Quota):

protocol imap {
mail_plugins = quota imap_quota
}
protocol pop3 {
mail_plugins = quota
}
# In case you're using deliver:
protocol lda {
mail_plugins = quota
}

imap_quota setting will provide quota status to IMAP clients.

My quota solution is maildir: quota = maildir:user.
Because I've got working quota_warning setting in Dovecot only when quota setting was set to maildir:user.

In case of quota setting is FS you should set quota_rule = *:storage=102400 (102400 is the size that Dovecot will calculate as a quota limit and calculate percent for quota_warning setting).
But in this case you'll have all users with equal mailbox sizes.
If it is acceptable for you it will be enough to set following settings in Dovecot:
------------
quota=fs
quota_rule = *:storage=102400
quota_warning = storage=80%% /usr/local/bin/quota-warning.sh 80
-------------
#!/bin/sh

PERCENT=$1
FROM="postmaster@domain"
qwf="/tmp/quota.warning.$$"

echo "From: $FROM
To: $USER
To: postmaster@domain
Subject: Your email quota is $PERCENT% full
Content-Type: text/plain; charset="UTF-8"

Your mailbox is now $PERCENT% full." >> $qwf

cat $qwf | /usr/sbin/sendmail -f $FROM "$USER"
rm -f $qwf

exit 0
------------------

where 80%% (double %% sign) is percent of quota limit when notification will trigger.
/usr/local/bin/quota-warning.sh - script that will be run when quota hit.

In case if you need different sizes of mailboxes for different users you should use Maildir quota.
In this case quota limit will be stored in file maildirsize of Maildir++ folder (in home folder).
Quota limit format in this file is like:
S,C

After that Postfix and Dovecot will update this file apon receiving and deleting messages like:
52428800S ## My quota setting
6021400 16 ## Server calculated that 6 messages size is 6021400 bytes
1076 1 ## added 1 message with 1076 size to folder
-3142 -3 ## deleted 3 messages total size 3142 bytes
-332400 -2 ## etc
-5074976 -6 ##etc
-611958 -6
3622986 1
332963 1
4564 1
4783 1
332790 1

So all you need is to generate maildirsize file with necessary quota limit in 1st line.
This way Dovecot and Postfix have actual information about messages size.

Now I'm writing a script that will generate limit to maildirsize based on filesystem quota of user.
So when FS quota fom mail user will be changed script should update maildirsize file with new limit.

The problem is how to run that script: cron by root or somehow run script with user priveleges triggered upon quota modification (will be more convinient).

I'll keep you informed if I'll manage to make quota notofication.

Or may be you have some ideas for this purpose?

Regards

Topic locked