On Mon, May 30, 2016 at 03:13:33PM -0700, Brad S Konia wrote:
> I have Postfix configured to pipe certain emails to a PHP script. This
> script then does something with the email and returns an exit code 0 if
> successful, or some exit code > 64 if a failure occurs. The problem is,
> Postfix seems to ignore the exit code. No matter what exit code it returns,
> the Postfix log always shows the mail was sent.
>
> Here's the line from master.cf that creates the transport:
>
> myrelay unix y n n - - pipe
> flags=R user=myrelayuser argv=/home/myrelay ${sender} ${recipient}
The Postfix pipe(8) delivery agent does not ignore exit codes.
> The last line in the myrelay script is an exit command, either exit(0) or
> exit(77), etc...
Successful delivery is reported only when /home/myrelay (if that's the
actual command path) exits with exit code 0.
> May 28 00:02:24 www postfix/pipe[26472]: 9FC4441056: to=<[email protected]
> <mailto:[email protected]>>, relay=myrelay, delay=1.4,
> delays=0.57/0.02/0/0.77, dsn=2.0.0, status=sent (delivered via myrelay
> service)
This means the exit code was 0. Do make sure that the content of
master.cf matches the running configuration, via 'postfix reload"
if master.cf was modified after Postfix was started.
--
Viktor.