DirectAdmin Knowledge Base and Support

DirectAdmin is a web panel for simple administration of both virtual and dedicated servers. DirectAdmin is faster, safe and more powerful than any other CP. And we know how to customize Directadmin and support it.

DirectAdmin Knowledge Base

How to keep a declined message in exim queue if quota exceeded in dovecot

| 00:53:08 13.09.2015

By default dovecot if mailbox quota is exceeded drops a 552 error which would mean for exim to decline the message without further retry to deliver it. In /var/log/exim/mainlog on Directadmin powered server you could see:

2015-09-13 00:43:00 1ZaplM-0004uQ-2Y <= U=root P=local S=6330851 T="test" from <> for
2015-09-13 00:43:00 1ZaplM-0004uQ-2Y ** F=<> R=virtual_user T=dovecot_lmtp_udp: LMTP error after end of data: 552 5.2.2 <> Quota exceeded (mailbox for user is full)
2015-09-13 00:43:00 1ZaplM-0004uQ-2Y Completed

The reply code 552 stands for "Requested mail action aborted: exceeded storage allocation.". So to make exim to put a declined message into queue instead of immediate decline we need to set quota_full_tempfail = yes in dovecot.

Configuring dovecot with CustomBuild 2.x 

If you run directadmin with custombuild 2 here are the instructions:

mkdir -p /usr/local/directadmin/custombuild/custom/dovecot/conf/
cp /usr/local/directadmin/custombuild/configure/dovecot/conf/lmtp.conf /usr/local/directadmin/custombuild/custom/dovecot/conf/

Open the file /usr/local/directadmin/custombuild/custom/dovecot/conf/lmtp.conf for editing and find section:

protocol lmtp {

and before the } (closing curly bracket) add a new line with:

quota_full_tempfail = yes

So that you would see something similar to the following:

protocol lmtp {
  !include lmtp_mail_plugins.conf
  log_path = /var/log/dovecot-lmtp-errors.log
  info_log_path = /var/log/dovecot-lmtp.log
  postmaster_address = postmaster@HOSTNAME
  quota_full_tempfail = yes

Save and exit. Run this:

./build update
./build set dovecot_conf yes
./build dovecot_conf

Restart dovecot

With this we made dovecot to return "452 Requested action not taken: insufficient system storage" if quota is exceeded, and exim will put an email in such a situation in a queue, and now we should change retry section in exim.conf

Configuring exim

Open /etc/exim.conf and find lines:

begin retry
*                      quota       
*                      *           F,2h,15m; G,16h,1h,1.5; F,4d,8h
# End of Exim 4 configuration

and remove

*                      quota 

save, exit and restart exim.

Now if you try to send an email to a full mailbox, you will see in exim's logs something like this:

2015-09-13 00:49:24 1ZaprY-0005vF-ES <= U=root P=local S=6330851 T="test" from <> for
2015-09-13 00:49:24 1ZaprY-0005vF-ES == R=virtual_user T=dovecot_lmtp_udp defer (-46): LMTP error after end of data: 452 4.2.2 <> Quota exceeded (mailbox for user is full)
check the exim queue:
[root@server ~]# exim -bp
42m  6.0M 1ZaprY-0005vF-ES <>

[root@server ~]#

P.S. As for now CustomBuild 2 does not give any instrument to customize retry section. Thus if you keep your exim.conf updated with custombuild you will loose all customization. So that's up to you to protect the file from being overwritten.

Tags: dovecot Exim LMTP Quotas 
About Us
We are a team of professionals, and specialize in installation, configuring and managing of remote virtual and dedicated servers powered by Linux/Unix-like OS with DirectAdmin. We support various sets of software, including web-servers Apache, Nginx; internet domain name servers Bind, PowerDNS; mail-servers with POP3, IMAP and SMTP, FTP-servers, etc. After years of working through the most complex server challenges our team has gathered valuable expirience and universal solutions suitable for everyday tasks. We are here to lend you a helping hand and take care of your servers in order to let you have enough time to do more of what you love.

All of the information and data on this site is for informational purposes only and is provided for the convenience of the user.
Powered by: Amiro.CMS - Free edition