Re: Best way to use trigger to email a report ?

From: Alan Hodgson <ahodgson(at)lists(dot)simkin(dot)ca>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Best way to use trigger to email a report ?
Date: 2020-05-08 17:10:02
Message-ID: 2ca625f832b4ea49c99c99d559a086441db97768.camel@lists.simkin.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2020-05-08 17:19:25 Re: Best way to use trigger to email a report ?
Previous Message Rob Sargent 2020-05-08 17:04:57 Re: Thoughts on how to avoid a massive integer update.