Re: Send email from PostgreSQL, may I ?

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Gerson Machado <gersonamach(at)yahoo(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Send email from PostgreSQL, may I ?
Date: 2006-10-27 13:40:03
Message-ID: 20061027134003.GM31183@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Gerson Machado wrote:
> I need send email directly from PG with on function, where locate this ?

Typically this is bad idea. Better save the email info on a table and
fire a NOTIFY. An external daemon would be listening to that
notification, and send the email from the data in the table, which it
can subsequently delete or mark as used.

This is also better because you have a chance to retry if your SMTP is
down or whatever. If you fail to send the mail in a trigger or
function, you have no way to wait 10 minutes without clogging your
application.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Staubo 2006-10-27 13:41:17 Re: skip duplicate key error during inserts
Previous Message Merlin Moncure 2006-10-27 13:38:22 Re: database not enforcing unqiue constriant