Re: Sending email from PL/pgSQL

From: Alan Hodgson <ahodgson(at)simkin(dot)ca>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Sending email from PL/pgSQL
Date: 2013-08-28 16:55:28
Message-ID: 1447585.KsiBEi0yGS@skynet.simkin.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wednesday, August 28, 2013 12:39:14 PM Jack Kaufman wrote:
> Would someone provide an example of how to send email from a PL/pgSQL
> function?
>
> Thanks in advance.
>
> Jack

I don't believe you can access anything external to PostgreSQL using PL/pgSQL.
You can create untrusted functions using other languages, though, like PL/Perl
or PL/Python, and use those languages' native libraries to send mail.

I wouldn't actually recommend doing so, though. I would suggest putting the
messages to be sent into a separate table and have an external script poll
that and send the mail as required.

Also, .jar files are for Java or Javascript, and are unlikely to have much to
do with your PostgreSQL installation.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Andreas Kretschmer 2013-08-28 16:56:52 Re: Sending email from PL/pgSQL
Previous Message Jack Kaufman 2013-08-28 16:39:14 Sending email from PL/pgSQL