pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alan Hodgson <ahodgson@lists.simkin.ca>
To: pgsql-general@lists.postgresql.org
Subject: Re: Best way to use trigger to email a report ?
Date: Fri, 08 May 2020 10:10:02 -0700
Message-ID: <2ca625f832b4ea49c99c99d559a086441db97768.camel@lists.simkin.ca> (raw)
In-Reply-To: <CAMBRECCgPueR=XqaGw42h_Or=sDg65AUYpqFwGK52SHktjzoog@mail.gmail.com>
References: <CAMBRECCgPueR=XqaGw42h_Or=sDg65AUYpqFwGK52SHktjzoog@mail.gmail.com>

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.

view thread (11+ messages)  latest in thread

Message-ID: <2ca625f832b4ea49c99c99d559a086441db97768.camel@lists.simkin.ca>
Permalink:  ../2ca625f832b4ea49c99c99d559a086441db97768.camel@lists.simkin.ca/
Also on:    postgresql.org/message-id/2ca625f832b4ea49c99c99d559a086441db97768.camel@lists.simkin.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ahodgson@lists.simkin.ca
  Subject: Re: Best way to use trigger to email a report ?
  In-Reply-To: <2ca625f832b4ea49c99c99d559a086441db97768.camel@lists.simkin.ca>
  References: <CAMBRECCgPueR=XqaGw42h_Or=sDg65AUYpqFwGK52SHktjzoog@mail.gmail.com> <2ca625f832b4ea49c99c99d559a086441db97768.camel@lists.simkin.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox