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.

Using Postfix and custom transports I can manage delivery speeds depending on the recipient's domain. (For example, I send max one message per second to *@hotmail.com)

I also use similar rules to block bad destinations (htmail.com is blocked right away, avoiding many loops in the queue).

However, I'd like to temporarily suspend mail delivery to a destination for 24 or 48 hours (mails to *@gmail.com suspended, everything else delivered). Messages would queue up during this time, and would be delivered only when I want by changing the config.

Does anyone know how to do that ?

Thanks

share|improve this question
add comment

3 Answers

up vote 7 down vote accepted

Put messages in a HOLD state

/etc/postfix/main.cf:

smtpd_recipient_restrictions = 
    ...
    check_recipient_access hash:/etc/postfix/hold

/etc/postfix/hold:

gmail.com        HOLD
blah.com         HOLD

Make sure you run postmap hash:/etc/postfix/hold whenever you update the file.

If you want to release all messages on hold, use:

# postsuper -r ALL
share|improve this answer
    
Thank you very much :) That's exactly what I wanted ! –  Julien Tartarin Dec 10 '09 at 15:02
    
Looks like it doesn't work after all. Mail is immediately submitted. Maybe because I send mail from $mynetworks ? REJECT and DISCARD don't work either, I had to go with transport's error: –  Julien Tartarin Dec 16 '09 at 17:05
    
Ok, my bad, mail sent locally with mailx is not checked because it's not sent to smtpd. Works very well :) –  Julien Tartarin Dec 16 '09 at 18:02
add comment

You can do this with a transport map:

gmail.com defer:

share|improve this answer
add comment

To put on hold for specific domain:

postqueue -p | awk 'BEGIN { RS = "" } { if ($7 == "your@domain.com" ) print $1 }' | tr -d '!*' | postsuper -h -

To release for a specific domain:

postqueue -p | awk 'BEGIN { RS = "" } { if ($7 == "your@domain.com" ) print $1 }' | tr -d '!*' | postsuper -H -
share|improve this answer
    
Just no. The $7 will match the Sender Email address on the same line as the queue ID. The recipient email address is on the next line, and it needs a domain match, not email match. –  anttiR Apr 12 at 11:00
add comment

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.