Обсуждение: Email in postgres

Поиск
Список
Период
Сортировка

Email in postgres

От
Rob
Дата:
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?

Thanks

--
Rob

He who dies with the most toys ...

                    ... still dies


Re: Email in postgres

От
Andrew McMillan
Дата:
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?