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

From: Anil Menon <gakmenon(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com>, "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-19 15:59:07
Message-ID: CAHzbRKczJ2iyZjmM8YpbS=A_8A2AV3W-AD0ei4d2R66YdRgzRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Using Apache camel
Listen/notify ->PGEvent Component (http://camel.apache.org/pgevent.html) ->
Mail Component (http://camel.apache.org/mail.html)
You can also then handle all the exceptions of the email server easily.

On Sun, Apr 19, 2015 at 6:42 AM, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com> wrote:

> On 4/18/15 12:52 AM, David G. Johnston wrote:
>
>> On Friday, April 17, 2015, Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com
>> <mailto: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.
>>
>
> 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
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message rob stone 2015-04-19 16:34:16 Re: Running pg_upgrade under Debian
Previous Message Andomar 2015-04-19 09:24:16 Re: Waiting on ExclusiveLock on extension

Browse pgsql-sql by date

  From Date Subject
Next Message Shawn Gennaria 2015-04-21 14:39:32 How to determine offending column for insert exceptions
Previous Message Jim Nasby 2015-04-18 22:42:01 Re: [SQL] function to send email with query results