2

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.

6
  • 5
    Obviously: why?
    – Steve-o
    Sep 17, 2011 at 15:33
  • @Steve-o for all the people who proof-read after they hit Send.
    – polynomial
    Sep 17, 2011 at 23:14
  • 1
    Put down the chocolate-covered banana, step away from the European currency systems, and try telling people your actual goal here, rather than the wacky idea that you've had for achieving your goal that you don't know how to realize.
    – JdeBP
    Sep 18, 2011 at 10:30
  • 1
    I respect your opinions and I respect my responsibilities in work. Answer by @cstamas is correct but was not approved by managers. I hope I don't need to clarify this more. Some comments quite surprised me.
    – zeratul021
    Sep 18, 2011 at 13:10
  • 1
    Tons of people proofread after sending and it's a big problem. Just about every forum (including this site) has the ability to edit comments for a few minutes. The ability to hold an email for a couple minutes just in case is very useful.
    – user101340
    Mar 23, 2015 at 15:44

3 Answers 3

-2

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

3
  • 3
    Better link to the original: postfix.org/SMTPD_POLICY_README.html
    – mailq
    Sep 17, 2011 at 23:59
  • 1
    I am not sure if I get this right. Are you suggesting to instead of answering immediately, delay the answer of the policy server? If so this will not work. It will timeout and postfix will refuse the mail (with a temporary error, but it does not help if the other end is a MUA).
    – cstamas
    Sep 18, 2011 at 3:39
  • Yeah you'd have to setup a global procmailrc for the MUA part, but you can safely delay up to 100s on the policy server without changing any timeouts. I wouldn't say its ideal but I think it would work.
    – polynomial
    Sep 18, 2011 at 5:14
3

This functionally should be implemented in the MUA. If you have a webmail you can install a plugin implementing this function. There is an extension available for Thunderbird. If a user sends an email and later changes her mind then she can cancel herself. I see no other way. Making nasty hacks on the server will just make things worse if one does not know all the answers already.

0

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!

2
  • You meant postsuper -H queue_id for releasing from hold, don't you?
    – cstamas
    Oct 10, 2011 at 7:11
  • @cstamas Yes you are right. It is -H.
    – mailq
    Oct 10, 2011 at 8:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .