Re: Sending email from PL/pgSQL

From: Luca Ferrari <fluca1978(at)infinito(dot)it>
To: Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com>
Cc: PGSQL-Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Sending email from PL/pgSQL
Date: 2013-08-29 06:37:12
Message-ID: CAKoxK+5NmFAo0c4Yr-d9t=mE4OMP4LXPahjinnnzfanFXeF9iQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Aug 28, 2013 at 9:03 PM, Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com> wrote:
> Alan and Andreas,
>
> Thank you! You both said essentially the same thing: That I will need to
> write the email attributes to a table and have a script on the server call
> the email client. So that is the way I will proceed. Thank you both for
> your replies and for helping me move along toward solving this problem.

Here you can find a very rudimental pl/perl stored procedure that will
send simple emails:
https://github.com/fluca1978/fluca1978-pg-utils/blob/master/bsdmag/03-server-side-programming/15-email-perl.sql

However, depending on the aim of your mail messaging, I would consider
having a shell script fecthing data out of PostgreSQL on a per-cron
basis and arranging a message to pipe thru a mail program (mutt,
sendmail, postfix, whatever). This can be much more general and will
let you reuse the mailing part for other jobs.

Luca

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jack Kaufman 2013-08-29 14:24:35 Re: Sending email from PL/pgSQL
Previous Message Jack Kaufman 2013-08-28 19:03:49 Re: Sending email from PL/pgSQL