Re: Best way to use trigger to email a report ? - Mailing list pgsql-general

From Alan Hodgson
Subject Re: Best way to use trigger to email a report ?
Date
Msg-id 2ca625f832b4ea49c99c99d559a086441db97768.camel@lists.simkin.ca
Whole thread Raw
In response to Best way to use trigger to email a report ?  (David Gauthier <davegauthierpg@gmail.com>)
List pgsql-general
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.

pgsql-general by date:

Previous
From: Rob Sargent
Date:
Subject: Re: Thoughts on how to avoid a massive integer update.
Next
From: Christophe Pettus
Date:
Subject: Re: Best way to use trigger to email a report ?