In Exim this would be handled by a wildcard alias, and a pipe transport. Look for the equivalent for Postfix. Aliases can be configured to specify a command to handle the message.
If you have other domains you wan to handle differently, setup virtual domain aliases and put the wildcard in the aliases file for the domain.
It looks like Postfix has a pipe daemon to handle deliveries to a command.
EDIT: Exim solution using split configuration. This requires installing the
exim4-daemon-light package. I would suggest you also install the
exim4-doc-html package to provide the documentation at
Add a file in
380_local-config_program_router. Check the options of generic routers i (chapter 15 and 16 in the specification). Change the script name and domain as required.
# This router runs /usr/bin/your-script for all users in your.domain.
driver = accept
require_files = /usr/bin/your-script
transport = program_transport
domains = your.domain
Add a file in
380_local-config_program_transport. Check the options for pipe transport (chapters 24 and 29 in the specification). You will need to set the options which don't have a value specified. Also set the correct command which can have options if required.
driver = pipe
command = /usr/bin/your-script
I modified the configuration from this post.
Edit2: It looks like you can do it with Postfix as well. A solution using a wildcard address for a virtual domain and a maildrop type indirect delivery should do it.