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

I am using pipe over SSH to deliver some e-mails for special processing to another server, what I have configured in master.cf.

foobar   unix    -   n   n   -   -   pipe
  flags=RF user=foobar:foobar argv=/usr/bin/ssh -T foobar@foobar /usr/local/bin/foobar ${recipient}

The problem I am having is that if this server is not available (or for some other reason SSH connection fails) whole delivery fails and sender receives message about that. What I would like is that if it fails that e-mail is put back into the queue for later retry. And only if for few days this delivery is not made that sender is notified about that. How can I configure Postfix in this way?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Add -o soft_bounce=yes to the definition in master.cf.

Example:

foobar   unix    -   n   n   -   -   pipe
  -o soft_bounce=yes
  flags=RF user=foobar:foobar argv=/usr/bin/ssh -T foobar@foobar /usr/local/bin/foobar ${recipient}

This will keep mail in the deferred queue forever (or until the machine comes back to life and postfix retries it), and will not bounce after a few days, but it's the best I could find (and even that was quite well hidden).

share|improve this answer
    
Thanks. This looks like what I need. It is not really a problem for me if it does not bounce after a few days. Will test it now and we will see. –  Mitar May 16 '11 at 13:58

If the command that pipe is delivering to returns an exit code of 75, then that causes the delivery to be deferred rather than bounced. Alternatively, if the first line of output appears to have an extended SMTP status (e.g. "4.2.0") that takes priority.

I would wrap up the ssh command in a shell script or something that detects a failure and converts that to the right output/exit status.

This allows the delivery program to flag messages as undeliverable as opposed to always having them retried. And keeps the soft_bounce option as a debugging safety net.

(I appreciate you already have an answer, but thought this might be useful as an alternative for anyone else finding this question)

share|improve this answer
    
Very interesting! How did you find out about that? Could you post any references? Thanks. –  Ricardo Pardini Aug 20 '11 at 4:31
    
+1 for knowing this, but next time give a reference! I found a detailed reference here postfix.org/FILTER_README.html. See irbs.net/internet/postfix/0712/1112.html for a shorter answer. groups.google.com/forum/#!topic/mailing.postfix.users/… as well. Here is a link with all the standard status codes opensource.apple.com/source/Libc/Libc-320/include/sysexits.h. The pipe man page (postfix.org/pipe.8.html) alludes to this, but I personally found a bit confusing at first. –  deuberger Aug 4 at 19:32
    
Also see tools.ietf.org/html/rfc3463 for info on the extended status codes. –  deuberger Aug 4 at 19:36

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.