Re: Email in postgres - Mailing list pgsql-novice

From Andrew McMillan
Subject Re: Email in postgres
Date
Msg-id 1019040741.5756.636.camel@kant.mcmillan.net.nz
Whole thread Raw
In response to Email in postgres  (Rob <rob@obsidian.co.za>)
List pgsql-novice
On Thu, 2002-04-18 at 00:30, Rob wrote:
> Hi all,
>
> I want to write a function (probably in plgsql, but I'm open to
> suggestions) that will send of an email to a specified address where a
> trigger is activated.  Is there any way to do this/anywhere I can get an
> example of this?

There have been a bunch of solutions to this posted over time, usually
with caveats like "don't".  One of the most intriguing that I have seen
involved the use of that little-known PostgreSQL function language
"PL/SH"!

I recommend you search the archives for your problem, but it is readily
achievable by using a language that supports 'system()' to write your
function in.

The firmly recommended solution is to write a record into the database
indicating that an e-mail needs to be sent, and then have an external
solution which looks at that table as often as it needs to.  This means
that you don't (e.g.) get a trigger blocking on god-knows-what OS level
operation that might be involved in sending mail.

Regards,
                    Andrew.
--
--------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/        PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201    MOB: +64(21)635-694    OFFICE: +64(4)499-2267
       Are you enrolled at http://schoolreunions.co.nz/ yet?


pgsql-novice by date:

Previous
From: Andrew McMillan
Date:
Subject: Re: Working with multiple selects?
Next
From: "Joshua b. Jore"
Date:
Subject: Re: Pl/Pgsql function troubles: FOLLOW UP