How to do SQL lookup in before_send hook?

MRob mrobti at
Sun Dec 11 22:22:42 CET 2016

I found a very helpful example on how to write a hook:

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?

More information about the amavis-users mailing list