3

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?

2 Answers 2

7

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).

2
  • 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, 2011 at 13:58
  • Thank you for this - 6 years later and it's the only place I've been able to find exactly where and how to do this (in my case because I want to avoid bounces due to NFS timeouts). Aug 1, 2017 at 18:30
6

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)

3

You must log in to answer this question.

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