Thread: Send Email from Postgressql

Send Email from Postgressql

From
brian stapel
Date:
Thanks for your time.
 
I need to notify a user that data has changed.  To accomplish this I'd like to create a trigger that watches the specified table, that on change, sends the results returned by a function in the body of an email to a specific user. 
 
Is this possible?
 


Live Search: Better results, fast Try it now!

Re: Send Email from Postgressql

From
"A. Kretschmer"
Date:
am  Thu, dem 01.02.2007, um  8:54:34 -0600 mailte brian stapel folgendes:
> Thanks for your time.
>
> I need to notify a user that data has changed.  To accomplish this I'd like to
> create a trigger that watches the specified table, that on change, sends the
> results returned by a function in the body of an email to a specific user.
>
> Is this possible?

Yes.

You can write such with a untrusted pl such as plperlu or plsh.
I have a function in plsh, within there i call mutt (a command-line mail
programm on linux) to send mail. The To: and other headers are
parameters.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: Send Email from Postgressql

From
brian stapel
Date:
Thanks for your quick reply.
 
So, working from your example, I would build a trigger that calls a function that calls the email program?
I'm new to PostgreSQL and I'm a windows developer.  I've been using PLPGSQL for all of my functions.  The other languages you mentioned, are they easily learned? 






> Date: Thu, 1 Feb 2007 16:03:57 +0100
> From: andreas.kretschmer@schollglas.com
> To: pgsql-novice@postgresql.org
> Subject: Re: [NOVICE] Send Email from Postgressql
>
> am Thu, dem 01.02.2007, um 8:54:34 -0600 mailte brian stapel folgendes:
> > Thanks for your time.
> >
> > I need to notify a user that data has changed. To accomplish this I'd like to
> > create a trigger that watches the specified table, that on change, sends the
> > results returned by a function in the body of an email to a specific user.
> >
> > Is this possible?
>
> Yes.
>
> You can write such with a untrusted pl such as plperlu or plsh.
> I have a function in plsh, within there i call mutt (a command-line mail
> programm on linux) to send mail. The To: and other headers are
> parameters.
>
>
> Andreas
> --
> Andreas Kretschmer
> Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
> GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings



Live Search: New search found Try it!

Re: Send Email from Postgressql

From
"A. Kretschmer"
Date:
am  Thu, dem 01.02.2007, um  9:10:57 -0600 mailte brian stapel folgendes:
> Thanks for your quick reply.
>
> So, working from your example, I would build a trigger that calls a function
> that calls the email program?
> I'm new to PostgreSQL and I'm a windows developer.  I've been using PLPGSQL for
> all of my functions.  The other languages you mentioned, are they easily
> learned?

Depends. For instance, do you have knowledge about the programming
language PERL? If so, then you don't have problems with plperlu, i
think. And for PERL there are tons of example code to send emails.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: Send Email from Postgressql

From
Bruno Wolff III
Date:
On Thu, Feb 01, 2007 at 08:54:34 -0600,
  brian stapel <brians_224@hotmail.com> wrote:
>
> I need to notify a user that data has changed.  To accomplish this I'd like to create a trigger that watches the
specifiedtable, that on change, sends the results returned by a function in the body of an email to a specific user.   

Yes this is possible to do with untrusted languages. For example you might
install perlu and write your function in that.

Re: Send Email from Postgressql

From
Devrim GUNDUZ
Date:
Hello,

On Thu, 2007-02-01 at 08:54 -0600, brian stapel wrote:
> I need to notify a user that data has changed.  To accomplish this I'd
> like to create a trigger that watches the specified table, that on
> change, sends the results returned by a function in the body of an
> email to a specific user.

http://archives.postgresql.org/pgsql-general/2006-10/msg01351.php

might work for you, I think.

Regards,
--
Devrim GÜNDÜZ
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/



Attachment