I found a very helpful example on how to write a hook:
https://marc.info/?l=postfix-users&m=128438735413057&w=2
But I need to do a SQL lookup in the before_send hook for outbound mail.
Two questions:
What's the most reliable way to retrieve our sending user? I found that
$msginfo->sender seems to work in my first test but I was not sure if
this was recommended or reliable.
I could write my own DB code to create a SQL connection and do the
needed lookup, but that might not be recommended (does amavis pool
database connections for instance?). What's the amavis way to do that?