Question: is there a way to configure delay with which emails will be processed by postfix?
What I'm aiming for is e.g. 5 minute lag between receiving mail from MUA and transferring it to mailbox or other MTA.

Thanks.

Answer: 
There is a way but it is such a stupid thing that I only provide the steps.

Put this into your recipient\_restrictions: `recipient_restrictions = ..., static:HOLD, ...`
Then you will get an output of `postqueue -p` where all mails in hold-queue are marked with an `!` (exclamation mark) and the arrival date. Use a cron-job and a script to parse and examine this output. If a mail is longer than x minutes in the queue you can reinject it to the Postfix delivery process by issuing a `postsuper -H [queue_id]`. The [queue\_id] is in the first column of `postqueue -p`.

And please don't ask for the script to automate this!
You could pretty easily do this by specifying a new master transport in the smtpd section of main.cf:

```
smtpd_recipient_restrictions = check_policy_service unix:private/sleep_delay, permit_mynetworks, reject_unauth_destination

```

Then in master.cf:

```
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
sleep_delay  unix  -       n       n       -       -       spawn
        user=nobody argv=/usr/bin/perl /path/to/your_script

```

In /path/to/your\_script, just have it sleep(X) and exit(0). You can use this script/config as an example of how to implement external script interaction with postfix:

<http://www.howtoforge.com/postfix_spf>