Re: Sending email from PL/pgSQL

From: Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com>
To: PGSQL-Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Sending email from PL/pgSQL
Date: 2013-08-28 19:03:49
Message-ID: CAM=VM82AJR2zixToTHDPgQ7z=hGfxvu5UU9LuO48Me7yrpozyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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.

Take care, Jack

On Wed, Aug 28, 2013 at 12:56 PM, Andreas Kretschmer <
akretschmer(at)spamfence(dot)net> wrote:

> Jack Kaufman <jack(dot)kaufman(at)sanmina(dot)com> wrote:
>
> > Would someone provide an example of how to send email from a PL/pgSQL
> function?
>
> You can't do that. Pl/pgsql is a so called 'trusted language', you can't
> call functions outside the database. What you can do:
>
> - fill a table with tasks (address, content and so) and use, for
> instance, a cron-job to retrieve data from this table, send the mail
> and delete the record
> - use untrusted languages like pl/perlU, pl/sh or other
> - use a listen/notify - mechanism to do that
>
> Within a pl/pgsql - function all is in a transaction - but you can't fetch
> back an email.
>
>
> Andreas
> --
> Really, I'm not out to destroy Microsoft. That will just be a completely
> unintentional side effect. (Linus Torvalds)
> "If I was god, I would recompile penguin with --enable-fly." (unknown)
> Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
>
>
> --
> Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-novice
>

--
Jack Kaufman
MDS Application Devl (US)
Sanmina-SCI Corporation - Owego site
Email: jack(dot)kaufman(at)sanmina(dot)com
Skype: jack_kaufman_sanm
607-723-0507

CONFIDENTIALITY
This e-mail message and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail message, you are hereby notified that any dissemination, distribution or copying of this e-mail message, and any attachments thereto, is strictly prohibited. If you have received this e-mail message in error, please immediately notify the sender and permanently delete the original and any copies of this email and any prints thereof.
ABSENT AN EXPRESS STATEMENT TO THE CONTRARY HEREINABOVE, THIS E-MAIL IS NOT INTENDED AS A SUBSTITUTE FOR A WRITING. Notwithstanding the Uniform Electronic Transactions Act or the applicability of any other law of similar substance and effect, absent an express statement to the contrary hereinabove, this e-mail message its contents, and any attachments hereto are not intended to represent an offer or acceptance to enter into a contract and are not otherwise intended to bind the sender, Sanmina Corporation (or any of its subsidiaries), or any other person or entity.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Luca Ferrari 2013-08-29 06:37:12 Re: Sending email from PL/pgSQL
Previous Message Kevin Hunter Kesling 2013-08-28 18:08:54 Re: cross-table constraints?