Re: [SQL] function to send email with query results

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: [SQL] function to send email with query results
Date: 2015-04-18 05:52:50
Message-ID: CAKFQuwZn1RVQyTP-9DVFa5KTjRUu2+1ykzQMFaU0Rj2dF17V6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On Friday, April 17, 2015, Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pai-Hung Chen 2015-04-18 06:30:56 Re: ORDER BY for jsonb
Previous Message David G. Johnston 2015-04-18 05:47:11 Re: "Cast" SRF returning record to a table type?

Browse pgsql-sql by date

  From Date Subject
Next Message John R Pierce 2015-04-18 06:57:42 Re: function to send email with query results
Previous Message Suresh Raja 2015-04-18 05:30:51 function to send email with query results