Re: Trigger email?

From: Jonathan Hedstrom <jhedstrom(at)desc(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger email?
Date: 2005-03-02 00:53:58
Message-ID: 42250EA6.1070506@desc.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Christopher Browne wrote:

>cool_screen_name90001(at)yahoo(dot)com (CSN) writes:
>
>
>>Is it possible to setup a trigger so that every time a
>>certain field is changed, an email is sent? Using
>>pl/pgsql.
>>
>>
>
>Something _like_ that is possible.
>
>
you can also do it directly with a trigger if you prefer:

CREATE TRIGGER alert_insert
AFTER INSERT OR UPDATE ON alert FOR EACH ROW
EXECUTE PROCEDURE alert_notify();

Where the alert_notify() function would then call pgmail() with a
meaningful subject and body etc -- see below

>What I would do instead is for the trigger to cause a record to be put
>into a table that might be called something like "submit_email".
>
>An asynchronous process (that might look for NOTIFY requests!) would
>then rummage thru submit_email to find messages it needs to send.
>
>
at which point you could then use pgmail() to send the email

http://sourceforge.net/projects/pgmail/

Attachment Content-Type Size
jhedstrom.vcf text/x-vcard 236 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message OpenMacNews 2005-03-02 01:21:14 howto? Fine Debugging control at cmd line
Previous Message Scott Frankel 2005-03-02 00:51:24 Re: sql join question