Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
4  
Obviously: why? –  Steve-o Sep 17 '11 at 15:33
    
@Steve-o for all the people who proof-read after they hit Send. –  polynomial Sep 17 '11 at 23:14
    
What? Who can proof-read you mails on the server? Somewhere deep in the queue-files-directories. Only in plain text. This still looks like a stupid idea. –  mailq Sep 17 '11 at 23:56
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 '11 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. –  Zeratul Sep 18 '11 at 13:10

3 Answers 3

up vote -1 down vote accepted

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

share|improve this answer
2  
Better link to the original: postfix.org/SMTPD_POLICY_README.html –  mailq Sep 17 '11 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 '11 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 '11 at 5:14

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.

share|improve this 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!

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.