Re: the feasibility of sending email from stored procedure in Postgres

Поиск
Список
Период
Сортировка
От Christopher Browne
Тема Re: the feasibility of sending email from stored procedure in Postgres
Дата
Msg-id d6d6637f0802150631h505931eby2aa7f75e9fe2d3d7@mail.gmail.com
обсуждение исходный текст
Ответ на the feasibility of sending email from stored procedure in Postgres  (hewei <heweiweihe@gmail.com>)
Ответы Re: the feasibility of sending email from stored procedure in Postgres
Список pgsql-general
On 2/14/08, hewei <heweiweihe@gmail.com> wrote:
> Can send email from stored procedure in Postgres?

In principle, yes, using one of the "untrusted" stored function
languages.  pl/perl, pl/sh, pl/python, and such.

I wouldn't do things that way...

I would instead queue messages (or suitable information about them) in
a table, and have a process outside PostgreSQL periodically poll for
them.  There are several benefits to that approach:

1.  You're not pushing error handling of email problems inside the
PostgreSQL back end.  That could be rather risky.

2.  You're not spawning an MTA connection every time you submit a
message.  This could be rather expensive.

In contrast, the "poll a queue" approach lets something completely
external deal with email problems.  And it should be able to submit
multiple messages more or less at once, which should improve
efficiency rather a lot; no need to open up sockets to port 25 a whole
bunch of times...
--
http://linuxfinances.info/info/linuxdistributions.html
"The definition of insanity is doing the same thing over and over and
expecting different results." -- assortedly attributed to Albert
Einstein, Benjamin Franklin, Rita Mae Brown, and Rudyard Kipling

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

Предыдущее
От: Tomás Di Doménico
Дата:
Сообщение: Re: Trying to understand encoding.
Следующее
От: "Phoenix Kiula"
Дата:
Сообщение: Re: Are indexes blown?