Re: [SQL] function to send email with query results - Mailing list pgsql-general

From David G. Johnston
Subject Re: [SQL] function to send email with query results
Date
Msg-id CAKFQuwZn1RVQyTP-9DVFa5KTjRUu2+1ykzQMFaU0Rj2dF17V6g@mail.gmail.com
Whole thread Raw
In response to function to send email with query results  (Suresh Raja <suresh.rajaabc@gmail.com>)
Responses Re: [SQL] function to send email with query results  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
List pgsql-general
On Friday, April 17, 2015, Suresh Raja <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.

David J.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: "Cast" SRF returning record to a table type?
Next
From: Pai-Hung Chen
Date:
Subject: Re: ORDER BY for jsonb