Re: Sending email from PL/pgSQL

Поиск
Список
Период
Сортировка
От Andreas Kretschmer
Тема Re: Sending email from PL/pgSQL
Дата
Msg-id 20130828165652.GA26856@tux
обсуждение исходный текст
Ответ на Sending email from PL/pgSQL  (Jack Kaufman <jack.kaufman@sanmina.com>)
Ответы Re: Sending email from PL/pgSQL  (Jack Kaufman <jack.kaufman@sanmina.com>)
Список pgsql-novice
Jack Kaufman <jack.kaufman@sanmina.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°


В списке pgsql-novice по дате отправления:

Предыдущее
От: Alan Hodgson
Дата:
Сообщение: Re: Sending email from PL/pgSQL
Следующее
От: Kevin Hunter Kesling
Дата:
Сообщение: Re: cross-table constraints?