Extend MTA Queue Lifetime
Summary
It may be necessary to hold incoming mail in queue on a Zimbra MTA for an extended period of time for events like mailstore outages, migrations, extended maintenance or upgrades. Holding mail in the MTA queue for an extended period will prolong the amount of time the Postfix MTA deems messages undeliverable which ultimately results in bounced mail.
MTA Queue Lifetime
The default MTA queue lifetime for Zimbra is 5 days and is controlled by the Postfix parameter maximal_queue_lifetime. To extend the amount of time messages will be held in the Postfix deferred queue, increase maximal_queue_lifetime using the postconf command. The maximal_queue_lifetime parameter is not stored anywhere else in Zimbra's configuration.
Modifying the queue lifetime affects all messages in queue. For example, if the oldest message in queue is 4 days old and the queue lifetime was increased to 15 days, then the message will expire in 11 days unless it is delivered.
Get the current value
su - zimbra postconf maximal_queue_lifetime maximal_queue_lifetime = 5d
Set the new value
postconf -e maximal_queue_lifetime=15d postfix reload
Delaying Queue Runs
By default, the Zimbra Postfix MTA runs the deferred queue every 5 minutes. If messages are not deliverable during the queue run, then they become subject to backoff intervals so Postfix is not retrying the same messages over and over every 5 minutes. The specifics of the backoff algorithm will not be discussed here, however, increasing the time between queue runs may be desired if the queue lifetime must be set to a very long period of time. Use the Postfix queue_run_delay parameter. The queue_run_delay is stored in Zimbra's local configuration (localconfig.xml) and is managed by the zmlocalconfig command.
Get the current value The default is 300s.
zmlocalconfig postfix_queue_run_delay postfix_queue_run_delay = 300s
Set the new value
zmlocalconfig -e postfix_queue_run_delay=1d postfix reload
MTA Hold Queue
Messages currently in any MTA queue can be placed into the hold queue where they become exempt from expiration regardless of age. Postfix will not attempt delivery of any message in the hold queue until they have been released.
Retrieve the number of messages in all queues
sudo ~/libexec/zmqstat hold=0 corrupt=0 deferred=2 active=0 incoming=0
Use the mailq command to retrieve a queue listing.
mailq -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- 84E151500C2* 356 Tue Aug 3 12:38:29 sender@domain.com admin@zmb.moc C29F915010A 976 Tue Aug 3 12:38:01 sender@domain.com (connect to mb100.zmb.moc[192.168.5.51]:7025: Connection refused) admin@zmb.moc -- 2 Kbytes in 2 Requests.
Move current messages to the hold queue
sudo postsuper -h ALL postsuper: Placed on hold: 2 messages
Retrieve the queue listing. Note queue ids containing the "!" symbol are in the hold queue.
mailq -Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient------- 84E151500C2! 356 Tue Aug 3 12:38:29 sender@domain.com (connect to mb100.zmb.moc[192.168.5.51]:7025: Connection refused) admin@zmb.moc C29F915010A! 976 Tue Aug 3 12:38:01 sender@domain.com (connect to mb100.zmb.moc[192.168.5.51]:7025: Connection refused) admin@zmb.moc -- 2 Kbytes in 2 Requests.
Retrieve a queue count
sudo ~/libexec/zmqstat hold=2 corrupt=0 deferred=0 active=0 incoming=0
Release held messages
Releasing held messages will place messages into the deferred queue until the next queue run.
sudo postsuper -H ALL
Flush the queue to start immediate queue processing
sudo postsuper -f
Categories: |