This is the check we are doing:
In the mail ACL we do a database query using the value $sender_host_address
deny
set acl_m1 = ${lookup pgsql{ select smtp_identify_user( \
'${quote_pgsql:$authenticated_id}',\
'${quote_pgsql:$sender_address}',\
'${quote_pgsql:$sender_host_address}'\
)}{$value}}
Message = ${substr_3:$acl_m1}
condition = ${if eq {${substr_0_3:$acl_m1}}{X: }}
defer
message = ${substr_3:$acl_m1}
condition = ${if eq {${substr_0_3:$acl_m1}}{Y: }}
accept
condition = ${if gt{${substr_0_3:$acl_m1}}{A: }}
we then choose to accept or defer depending on what we get.