Skip site navigation (1) Skip section navigation (2)

Re: sending mail from Postgres

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Aftab Alam <aalam(at)tatashare(dot)com>
Cc: "'postgre'" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: sending mail from Postgres
Date: 2005-12-27 17:41:14
Message-ID: 20051227174114.GA70280@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-admin
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

In response to

Responses

pgsql-admin by date

Next:From: Jim C. NasbyDate: 2005-12-27 20:56:38
Subject: Re: file in posgres
Previous:From: Koen MartensDate: 2005-12-27 14:23:05
Subject: Re: How to run a posgresql function/procedure thro crontab

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group