From: Michael Fuhr <mike@fuhr.org>
To: Aftab Alam <aalam@tatashare.com>
Cc: 'postgre' <pgsql-admin@postgresql.org>
Subject: Re: sending mail from Postgres
Date: Tue, 27 Dec 2005 10:41:14 -0700
Message-ID: <20051227174114.GA70280@winnie.fuhr.org> (raw)
In-Reply-To: <000401c60ac5$f3896260$ec1010ac@aftabn463>
References: <002c01c60abf$4acb3320$cd00000a@amiindiahjwbgh>
<000401c60ac5$f3896260$ec1010ac@aftabn463>
On Tue, Dec 27, 2005 at 02:44:32PM +0530, Aftab Alam wrote:
> How can i send mail form postgresql.
You could write a function in a language like plperlu, pltclu, or
plpython, but a problem with functions that have effects outside
the database is that those effects can't be undone if the transaction
rolls back. A common example is a trigger that sends email when a
table is changed: if the trigger fires and then you roll back the
transaction, it's too late to cancel the email. Depending on what
you're doing it might be better to use LISTEN/NOTIFY and have a
client program send email when it receives a notification (notifications
are sent only when the transaction commits).
--
Michael Fuhr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mike@fuhr.org, aalam@tatashare.com
Subject: Re: sending mail from Postgres
In-Reply-To: <20051227174114.GA70280@winnie.fuhr.org>
References: <002c01c60abf$4acb3320$cd00000a@amiindiahjwbgh> <000401c60ac5$f3896260$ec1010ac@aftabn463> <20051227174114.GA70280@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox