[Dovecot] rejecting mail due to quota exceeded
Hi,
we are using dovecot's deliver to deliver mails to a virtual mailbox tree owned by the vmail user, by piping the message to the following command spawned by vmail:
/usr/bin/env HOME=/srv/vmail/mydomain.ch/myaccount /usr/lib/dovecot/deliver
When a message is delivered to an account that has reached its quotum, deliver issues a failure message saying:
From: Mail Delivery Subsystem postmaster@seamus.madduck.net To: $ENVELOPE_SENDER Message-ID: dovecot-1221640816-796581-0@seamus Subject: Automatically rejected mail
Your message to <vmail> was automatically rejected: Quota exceeded
The original message is attached, which is nice, however, I don't like the dovecot rejection message for two reasons:
- there was no message to <vmail> sent, dovecot should use the envelope recipient
considering that it doesn't know the envelope recipient, this would best be solved by
- don't accept the mail and send out a rejection, just exit 69 and write the reason to stderr!
Did I miss something and is this already possible with dovecot's deliver in a virtual setting?
Thanks,
-- martin | http://madduck.net/ | http://two.sentenc.es/
"how do you feel about women's rights?" "i like either side of them." -- groucho marx
spamtraps: madduck.bogus@madduck.net
On Wed, Sep 17, 2008 at 09:55:16AM +0100, martin f krafft wrote:
When a message is delivered to an account that has reached its quotum, deliver issues a failure message saying:
[...]
considering that it doesn't know the envelope recipient, this would best be solved by
- don't accept the mail and send out a rejection, just exit 69 and write the reason to stderr!
Did I miss something and is this already possible with dovecot's deliver in a virtual setting?
To exit with EX_TEMPFAIL instead of sending a rejection message, use deliver's -e flag and the following dovecot.conf snippet, taken straight from our mail server.
protocol lda {
# If user is over quota, return with temporary failure instead of # bouncing the mail. quota_full_tempfail = yes quota_exceeded_message = 4.2.2 Mailbox full
}
We only changed quota_exceeded_message because of Postfix' support of enhanced status codes, which gets you a nice bounce message with the right diagnostic code.
This requires dovecot 1.0.1 or later, according to http://wiki.dovecot.org/LDA; additionally writing the rejection reason to stderr requires dovecot 1.1.1 or later.
also sprach Ulrich Zehl ulrich-dovecot@topfen.net [2008.09.17.1031 +0100]:
To exit with EX_TEMPFAIL instead of sending a rejection message, use deliver's -e flag and the following dovecot.conf snippet, taken straight from our mail server.
Now I also found it on the wiki, and it works... well, I don't know exactly what quota_full_tempfail does, because deliver now exits with 77, but since I am calling it from procmail anyway, I now just do:
:0 w |/usr/bin/env HOME=$HOME $DELIVER -d $RECIPIENT -e
:0 e { EXITCODE=75 LOG="LDA failed with exit code $? for $RECIPIENT" HOST }
and that works, although I will need to polish the output a bit.
Thanks a lot,
-- martin | http://madduck.net/ | http://two.sentenc.es/
"a woman begins by resisting a man's advances and ends by blocking his retreat." -- oscar wilde
spamtraps: madduck.bogus@madduck.net
participants (2)
-
martin f krafft
-
Ulrich Zehl