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 last line in the myrelay script is an exit command, either exit(0) or 
exit(77), etc... I also tried outputting an enhanced status code like 5.X.X 
prior to the exit statement, but it seemed to make no difference. 

Here's an example line from the log: 

May 28 00:02:24 www postfix/pipe[26472]: 9FC4441056: to=<redac...@xyz.com 
<mailto:redac...@xyz.com>&gt;, relay=myrelay, delay=1.4, 
delays=0.57/0.02/0/0.77, dsn=2.0.0, status=sent (delivered via myrelay service) 

Can someone please help me understand how to get Postfix to recognize a failure 
exit status and log it correctly? 

Reply via email to