I'm running postfix on Debian 11, together with procmail as lda. Some users have a ~/.procmailrc which calls an external program, parsing the mail and doing things accordingly. This works as expected, as long as nothing goes wrong.
Goal definition
I found out that if the program being run within a procmail recipe exits with an error, the mail is put into the user's local mailbox and no further action is done. This is not my intended outcome. I want the mail to stay in the postfix queue, so the next queue run can try delivery again. Just akin to a temporary failure when mail can't be delivered through SMTP to another host for a temporary error condition on the remote host's side.
Postfix + procmail
I'm using this configuration parameter in /etc/postfix/main.cf:
mailbox_command = procmail -t -a "$EXTENSION"
According to the procmail man page -t
should force a soft-fail — as intended —, but this apparently doesn't work with postfix? Unfortunately, I found no documentation about how postfix is expected to handle rc!=0
with external mailbox_commands.
I found a source explaining how to write a ~/procmailrc-recipe to force procmail to exit with the error of a called program. This is the snippet I was using for testing purposes:
:0
* ^Subject: failme$
{
:0wc
|/usr/bin/false
:0
{ EXITCODE=$? }
}
This works basically: Postfix recognizes the lda exited with an error, and immediately bounces the mail.
So I guess there might be a setting in Postfix I'm missing, despite having browsed postconf(5) for keywords like error and defer, and read local(8).
Summary
How to configure Postfix so that mails are kept in the queue when the lda fails?