How to configure postfix as open relay (i want to accept all mail) but use my script foo as tranport and not really relay.
Transport maps can be regular expression based, and also support wildcards, so you can use a *. From the documentation on transport maps
* transport:nexthop The special pattern * represents any address (i.e. it functions as the wild-card pattern, and is unique to Postfix transport tables).
With that combined with your own mail delivery service, defined in master.cf, you can call your script for the emails. That being said, you don't have to mess with the transport maps, you can simply change the default_transport to be your newly defined mail handler in master.cf.
You want to look at the transport table which defines what transport to use for what domains.