[Dovecot] Warning recipient when message delivery fails due to over-quota

2013-06-24 Thread Ben Johnson
I'm working to configure automated quota notifications in Dovecot and am
wondering if it is possible to send a warning message to a user when
message delivery fails because the user is over-quota.

I already have the following directives configured:

  quota_warning = storage=95%% quota-warning 95 %u %d
  quota_warning2 = storage=80%% quota-warning 80 %u %d
  quota_warning3 = -storage=100%% quota-below below %u %d

These seem to function as expected, but the problem I'm facing is that
when a message is large enough to take the user's quota from, say, 84%
to over 100%, the message is rejected (as expected), but the user is
never warned that a message failed to be delivered because it would have
put him over 100% usage.

I suppose that I'm looking for a trigger that is tripped when delivering
the message *would* put the user over-quota (as opposed to *does in
fact* put the user over).

The sender receives an automated rejection message already. I'm
wondering if the recipient can be warned at the same time. (I'm not
concerned about further increasing the user's quota consumption with the
warning message; I would set noenforcing to 1.)

Is this possible? Any help is much appreciated. Thanks in advance.

-Ben


Re: [Dovecot] Warning recipient when message delivery fails due to over-quota

2013-06-24 Thread Ken A

On 6/24/2013 1:02 PM, Ben Johnson wrote:
 I'm working to configure automated quota notifications in Dovecot and am
 wondering if it is possible to send a warning message to a user when
 message delivery fails because the user is over-quota.
 
 I already have the following directives configured:
 
   quota_warning = storage=95%% quota-warning 95 %u %d
   quota_warning2 = storage=80%% quota-warning 80 %u %d
   quota_warning3 = -storage=100%% quota-below below %u %d
 
 These seem to function as expected, but the problem I'm facing is that
 when a message is large enough to take the user's quota from, say, 84%
 to over 100%, the message is rejected (as expected), but the user is
 never warned that a message failed to be delivered because it would have
 put him over 100% usage.
 
 I suppose that I'm looking for a trigger that is tripped when delivering
 the message *would* put the user over-quota (as opposed to *does in
 fact* put the user over).
 
 The sender receives an automated rejection message already. I'm
 wondering if the recipient can be warned at the same time. (I'm not
 concerned about further increasing the user's quota consumption with the
 warning message; I would set noenforcing to 1.)
 
 Is this possible? Any help is much appreciated. Thanks in advance.
 
 -Ben
 

You can give some additional space = the max message size allowed in
your email system, like in the example:
http://wiki2.dovecot.org/Quota/Configuration#line-1-5
(change Trash to Inbox). Then the message would be accepted, and the
user would get the normal 100% notice.

Ken

-- 
Ken Anderson
Pacific Internet - http://www.pacific.net


Re: [Dovecot] Warning recipient when message delivery fails due to over-quota

2013-06-24 Thread Ben Johnson


On 6/24/2013 2:21 PM, Ken A wrote:
 You can give some additional space = the max message size allowed in
 your email system, like in the example:
 http://wiki2.dovecot.org/Quota/Configuration#line-1-5
 (change Trash to Inbox). Then the message would be accepted, and the
 user would get the normal 100% notice.
 
 Ken

Thank you for the quick reply, Ken.

What you describe sounds like it would work for my purposes. (Although,
it would be nice to see quota warnings for would [instead of did]
scenarios implemented.)

I added quota_rule4 to my plugin {} stanza:

plugin {
  quota_rule2 = Trash:storage=+100M
  quota_rule3 = Junk:ignore
  quota_rule4 = Inbox:storage=+100M
}

I then restarted Dovecot.

My test user's quota is at 94% of 3MB before I attempt to send a message
with a 206KB attachment.

When I send the test message that should, in theory, put my test user
over-quota, but well within the additional 100M that quota_rule4 grants,
the message is still rejected outright. Here is the debug output that I
captured:

http://pastebin.com/75byrwC7

In particular, the following line seems to imply that this rule should
be effective:

dovecot: lda(u...@example.com): Debug: Quota rule: root=user
mailbox=Inbox bytes=+104857600 messages=0

Any thoughts as to why this might be happening?

My doveconf -n output:

http://pastebin.com/eZcmEWYA

Thanks again for your help,

-Ben


Re: [Dovecot] Warning recipient when message delivery fails due to over-quota

2013-06-24 Thread Timo Sirainen
On 24.6.2013, at 22.32, Ben Johnson b...@indietorrent.org wrote:

 plugin {
  quota_rule2 = Trash:storage=+100M
  quota_rule3 = Junk:ignore
  quota_rule4 = Inbox:storage=+100M
 }
 
 When I send the test message that should, in theory, put my test user
 over-quota, but well within the additional 100M that quota_rule4 grants,
 the message is still rejected outright. Here is the debug output that I
 captured:

Try if uppercased INBOX works. Also this can better be done with the 
quota_grace feature in v2.2.



Re: [Dovecot] Warning recipient when message delivery fails due to over-quota

2013-06-24 Thread Ben Johnson


On 6/24/2013 4:00 PM, Timo Sirainen wrote:
 On 24.6.2013, at 22.32, Ben Johnson b...@indietorrent.org wrote:
 
 plugin {
  quota_rule2 = Trash:storage=+100M
  quota_rule3 = Junk:ignore
  quota_rule4 = Inbox:storage=+100M
 }

 When I send the test message that should, in theory, put my test user
 over-quota, but well within the additional 100M that quota_rule4 grants,
 the message is still rejected outright. Here is the debug output that I
 captured:
 
 Try if uppercased INBOX works. Also this can better be done with the 
 quota_grace feature in v2.2.
 

That was it! Thank you, Timo!

I will look into the quota_grace feature in 2.2; that sounds like
exactly what I want.

Your time and generosity are deeply appreciated.

-Ben