Fixing Postfix sender_bcc_maps not working with PostSRSd

Postfix sender_bcc_maps will not work if PostSRSd (or similar SRS software) is used, because it rewrites all sender addresses to internal format that looks like this

srs0=ryhc=ug=domain.tld=user.name@...

and therefore the per-user / per-domain rules will never match.

Fortunately, in case that you are using Postfix with mysql table, you can modify the query like this:

query = SELECT sender_cc FROM mail_user WHERE (email = '%s'
   OR email = regexp_replace('%s', '^srs0=.+?=..=(.+)=(.+)@.*$', '\\2@\\1')
   OR email = regexp_replace('%s', '^srs0=.+?=..=(.+)=(.+)@.*$', '@\\1'))
   AND ...

to make it work again.