agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedfunction to send email with query results
6+ messages / 6 participants
[nested] [flat]
* function to send email with query results
@ 2015-04-18 05:30 Suresh Raja <suresh.rajaabc@gmail.com>
0 siblings, 3 replies; 6+ messages in thread
From: Suresh Raja @ 2015-04-18 05:30 UTC (permalink / raw)
To: pgsql-general@postgresql.org; pgsql-sql
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.
Thanks,
-Suresh Raja
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] function to send email with query results
@ 2015-04-18 05:52 David G. Johnston <david.g.johnston@gmail.com>
parent: Suresh Raja <suresh.rajaabc@gmail.com>
2 siblings, 1 reply; 6+ messages in thread
From: David G. Johnston @ 2015-04-18 05:52 UTC (permalink / raw)
To: Suresh Raja <suresh.rajaabc@gmail.com>; +Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>; pgsql-sql
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.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: function to send email with query results
@ 2015-04-18 06:57 John R Pierce <pierce@hogranch.com>
parent: Suresh Raja <suresh.rajaabc@gmail.com>
2 siblings, 0 replies; 6+ messages in thread
From: John R Pierce @ 2015-04-18 06:57 UTC (permalink / raw)
To: pgsql-general@postgresql.org
On 4/17/2015 10:30 PM, Suresh Raja wrote:
>
> 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.
I would do that in an application, not a plXXXX sql function. make a
query, fetch the results, format them as you see fit for the email and
toss it at your language-of-choice's email facility.
--
john r pierce, recycling bits in santa cruz
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: function to send email with query results
@ 2015-04-18 11:04 Andreas Kretschmer <akretschmer@spamfence.net>
parent: Suresh Raja <suresh.rajaabc@gmail.com>
2 siblings, 0 replies; 6+ messages in thread
From: Andreas Kretschmer @ 2015-04-18 11:04 UTC (permalink / raw)
To: pgsql-sql
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.
Only with functions written in untrusted languages, for instance pl/sh or
pl/perlU. Not with pure SQL, no with pl/pgsql or similar.
Consider: you can't rollback a conveyed mail.
Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknown)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] function to send email with query results
@ 2015-04-18 22:42 Jim Nasby <Jim.Nasby@BlueTreble.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Jim Nasby @ 2015-04-18 22:42 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; Suresh Raja <suresh.rajaabc@gmail.com>; +Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>; 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
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [SQL] function to send email with query results
@ 2015-04-19 15:59 Anil Menon <gakmenon@gmail.com>
parent: Jim Nasby <Jim.Nasby@BlueTreble.com>
0 siblings, 0 replies; 6+ messages in thread
From: Anil Menon @ 2015-04-19 15:59 UTC (permalink / raw)
To: Jim Nasby <Jim.Nasby@bluetreble.com>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Suresh Raja <suresh.rajaabc@gmail.com>; pgsql-general@postgresql.org <pgsql-general@postgresql.org>; 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.Nasby@bluetreble.com> wrote:
> 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
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2015-04-19 15:59 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-04-18 05:30 function to send email with query results Suresh Raja <suresh.rajaabc@gmail.com>
2015-04-18 05:52 ` David G. Johnston <david.g.johnston@gmail.com>
2015-04-18 22:42 ` Jim Nasby <Jim.Nasby@BlueTreble.com>
2015-04-19 15:59 ` Anil Menon <gakmenon@gmail.com>
2015-04-18 06:57 ` John R Pierce <pierce@hogranch.com>
2015-04-18 11:04 ` Andreas Kretschmer <akretschmer@spamfence.net>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox