On Fri, 2020-05-08 at 12:26 -0400, David Gauthier wrote: > psql (9.6.0, server 11.3) on linux > > Looking for ideas. I want a trigger to... > 1) compose an html report based on DB content > 2) email the report to a dist list (dl = value of a table column) > > If this will involve hybrid coding, I prefer PL/perl. The linux env > has both "mail" and "mutt" (if this is of any help). >
plperlu can access resources outside PostgreSQL. I'd suggest using Net::Mail and Net::SMTP to compose and send the mail to localhost:25. This avoids any shell escaping issues and still lets your local MTA accept the mail immediately and deliver it when it can.