Re: Sending Email - Mailing list pgsql-novice

From Jason Earl
Subject Re: Sending Email
Date
Msg-id 871ygodemk.fsf@npa01zz001.simplot.com
Whole thread Raw
In response to Sending Email  (denis@coralindia.com)
Responses Re: Sending Email  (Bud Rogers <budr@sirinet.net>)
List pgsql-novice
denis@coralindia.com writes:

> Hi all,
>
> Is there any package / procedure in PostGres to send email (like
> UTL_SMTP in Oracle)
>
> Thanx
>
> Denis

The way to do this in a transaction safe way is to have some sort of
process that runs outside of PostgreSQL.  You put the information
necessary to generate your email into a table, and then you call the
process (probably from cron).  This makes it much easier to do error
checking.  Instead of firing triggers from PostgreSQL and hoping that
the mail actually gets sent.  You simply select from your outgoing
mail table, create the necessary emails, and remove the entries in the
table.  This allows you to rollback changes to your database on
failure, and guarantees that a problem with your email setup won't
send valuable mail to the bit bucket.

Besides, generating and sending email is probably easier to do from
Python or Perl than any method available internally to PostgreSQL.

Jason

pgsql-novice by date:

Previous
From: Stephen Ingram
Date:
Subject: NULLs on datetime problem (for me at least :) )
Next
From: pxn
Date:
Subject: backend closed the channel unexpectedly