agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: David G. Johnston <david.g.johnston@gmail.com>
To: Suresh Raja <suresh.rajaabc@gmail.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: [SQL] function to send email with query results
Date: Sat, 18 Apr 2015 17:42:01 -0500
Message-ID: <5532DDB9.4070507@BlueTreble.com> (raw)
In-Reply-To: <CAKFQuwZn1RVQyTP-9DVFa5KTjRUu2+1ykzQMFaU0Rj2dF17V6g@mail.gmail.com>
References: <CAJP7dtCrT1C9S0g9haYVy=q01-bADZ2apJqS7avjT_-kScbO6w@mail.gmail.com>
	<CAKFQuwZn1RVQyTP-9DVFa5KTjRUu2+1ykzQMFaU0Rj2dF17V6g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>

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


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



view thread (6+ messages)  latest in thread

Message-ID: <5532DDB9.4070507@BlueTreble.com>
Permalink:  ../5532DDB9.4070507@BlueTreble.com/
Also on:    postgresql.org/message-id/5532DDB9.4070507@BlueTreble.com

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Jim.Nasby@BlueTreble.com, david.g.johnston@gmail.com, suresh.rajaabc@gmail.com, pgsql-general@postgresql.org
  Subject: Re: [SQL] function to send email with query results
  In-Reply-To: <5532DDB9.4070507@BlueTreble.com>

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

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