I have a mailserver forwarding mail and using postsrsd for SRS. Since postsrsd uses postfix's mydomain
setting to alter the Return-Path, is there a way to set the SRS_DOMAIN for forwarded mail based on the recipient address instead of setting it statically? Since the mailserver handles mail for several different domains, I'd like the return path to match the recipient's domain, not the hostname of the mailserver.
No, it can't due to the way PostSRSd is integrated with Postfix.
Your idea is PostSRSd need to read the recipient address so it can rewrite based on it. Unfortunately PostSRSd uses
sender_canonical_maps
to provide rewriting scheme. With this scheme PostSRSd only get get the sender address only. AFAIK, postfix doesn't have feature to rewriting sender address based on recipient address. You can try to read the official docs.