'Postfix return 5xx after LMTP reject

I have postfix configured to deliver mail using LMTP, and my MDA (Dovecot) uses its SIEVE implementation to filter mail. One of my scripts uses the reject command, but the problem is that by the time Postfix sends the email to LMTP, it’s already accepted the message from the sender, the reject command fails, and the email ends up bring kept.

Can I configure Postfix to only enqueue a message if the LMTP server isn’t available? Will this allow me to reject messages from a sieve script, or is there something in the LMTP protocol that would prevent this from ever happening?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source