Re: Email in postgres

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: Rob <rob(at)obsidian(dot)co(dot)za>
Cc: pgsql-novice(at)postgresql(dot)org, PostgreSQL Server <postgres(at)obsidian(dot)co(dot)za>
Subject: Re: Email in postgres
Date: 2002-04-17 10:52:21
Message-ID: 1019040741.5756.636.camel@kant.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Joshua b. Jore 2002-04-17 12:26:44 Re: Pl/Pgsql function troubles: FOLLOW UP
Previous Message Andrew McMillan 2002-04-17 10:22:49 Re: Working with multiple selects?