Re: [GENERAL] function to send email with query results - Mailing list pgsql-sql

From Jim Nasby
Subject Re: [GENERAL] function to send email with query results
Date
Msg-id 5532DDB9.4070507@BlueTreble.com
Whole thread Raw
In response to Re: function to send email with query results  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: [GENERAL] function to send email with query results  (Anil Menon <gakmenon@gmail.com>)
List pgsql-sql
On 4/18/15 12:52 AM, David G. Johnston wrote:
> On Friday, April 17, 2015, Suresh Raja <suresh.rajaabc@gmail.com
> <mailto:suresh.rajaabc@gmail.com>> wrote:
>
>     Hi all:
>
>     I'm looking to write a function to send email with result of a
>     query.    Is it possible to send email with in a function.  Any help
>     is appreciated.
>
>
> Yes...though neither the neither the sql nor the plpgsql languages have
> the necessary language features to do so - you will need to use
> something like plperlu.
>
> An (not mutually exclusive) alternative is to create an email queue and
> write an email sending client application to process that queue.  The
> main advantages being loose coupling and the ability to send the emails
> asynchronously.

If you go that route you might find LISTEN/NOTIFY useful:
http://www.postgresql.org/docs/9.4/static/sql-listen.html
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


pgsql-sql by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: function to send email with query results
Next
From: Anil Menon
Date:
Subject: Re: [GENERAL] function to send email with query results