Postfix – delay mail processing

postfix

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.

Best Answer

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

Related Topic