Re: Send email from PostgreSQL, may I ?

Lists: pgsql-general
From: Gerson Machado <gersonamach(at)yahoo(dot)com(dot)br>
To: pgsql-general(at)postgresql(dot)org
Subject: Send email from PostgreSQL, may I ?
Date: 2006-10-27 11:11:01
Message-ID: 20061027111102.89920.qmail@web54212.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

I need send email directly from PG with on function, where locate this ?

Tks


---------------------------------
Yahoo! Search
Música para ver e ouvir: You're Beautiful, do James Blunt


From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Send email from PostgreSQL, may I ?
Date: 2006-10-27 11:26:14
Message-ID: 20061027112614.GG14485@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

am Fri, dem 27.10.2006, um 11:11:01 +0000 mailte Gerson Machado folgendes:
> I need send email directly from PG with on function, where locate this ?

There isn't such a function. But you can use untrusted languages to do
this. I'm using plsh for this and send emails with my favorite MUA mutt.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net


From: Devrim GUNDUZ <devrim(at)commandprompt(dot)com>
To: Gerson Machado <gersonamach(at)yahoo(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Send email from PostgreSQL, may I ?
Date: 2006-10-27 13:07:00
Message-ID: 1161954420.2581.16.camel@laptop.gunduz.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi,
On Fri, 2006-10-27 at 11:11 +0000, Gerson Machado wrote:
> I need send email directly from PG with on function, where locate
> this ?

You can send e-mails via pltclu or plperlu, more is also possible.

http://sourceforge.net/projects/pgmail/ <- This is tcl one.

plperlu one is attached. I don't remember where I got this one.

Regards,
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

Attachment Content-Type Size
sendmail.plperlu text/plain 609 bytes

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Gerson Machado <gersonamach(at)yahoo(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Send email from PostgreSQL, may I ?
Date: 2006-10-27 13:40:03
Message-ID: 20061027134003.GM31183@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Gerson Machado wrote:
> I need send email directly from PG with on function, where locate this ?

Typically this is bad idea. Better save the email info on a table and
fire a NOTIFY. An external daemon would be listening to that
notification, and send the email from the data in the table, which it
can subsequently delete or mark as used.

This is also better because you have a chance to retry if your SMTP is
down or whatever. If you fail to send the mail in a trigger or
function, you have no way to wait 10 minutes without clogging your
application.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


From: "Taras Kopets" <tkopets(at)gmail(dot)com>
To: "Gerson Machado" <gersonamach(at)yahoo(dot)com(dot)br>, pgsql-general(at)postgresql(dot)org
Subject: Re: Send email from PostgreSQL, may I ?
Date: 2006-10-27 14:04:54
Message-ID: ce3f16fd0610270704i1ea0046bp7bb2426ed8411fca@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi!

Gerson Machado wrote:

> I need send email directly from PG with on function, where locate this ?

Alvaro Herrera wrote:

> Typically this is bad idea. Better save the email info on a table and
> > fire a NOTIFY. An external daemon would be listening to that
> > notification, and send the email from the data in the table, which it
> > can subsequently delete or mark as used.
> >
>
If you still want to send e-mails directly from PG, you can try to use my
function based on pgmail which will allow you to send e-mail using
mailservers
which require authorization and analyze relpy from smtp to be sure your
e-mail is sent (look in attachment). You will need to install pltclu first.

PS: Maybe anyone knows how to send a unicode characters in e-mail using Tcl?

Taras Kopets

Attachment Content-Type Size
my_tcl_sendmail.sql text/sql 3.7 KB

From: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Send email from PostgreSQL, may I ?
Date: 2006-10-27 17:09:57
Message-ID: 45423D65.4080209@amsoftwaredesign.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


> Typically this is bad idea. Better save the email info on a table and
> fire a NOTIFY. An external daemon would be listening to that
> notification, and send the email from the data in the table, which it
> can subsequently delete or mark as used.
>
> This is also better because you have a chance to retry if your SMTP is
> down or whatever. If you fail to send the mail in a trigger or
> function, you have no way to wait 10 minutes without clogging your
> application.
>
>
I wouldn't go so far as to say it's a bad idea(it really depends on what
you need to do).
I have been using a plperl based solution in a heavily used client
server application.

We don't send the emails via a trigger though, strictly initiated by a
procedure call from the client. Never had one single problem doing it
this way.

You wouldn't clog your application if you initiate the process through a
separate connection to the server which is initiated from a thread.

--
Tony Caduto
AM Software Design
http://www.amsoftwaredesign.com
Home of PG Lightning Admin for Postgresql
Your best bet for Postgresql Administration


From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Tony Caduto <tony_caduto(at)amsoftwaredesign(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Send email from PostgreSQL, may I ?
Date: 2006-10-27 17:32:36
Message-ID: 454242B4.7090607@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Tony Caduto wrote:
>
>> Typically this is bad idea. Better save the email info on a table and
>> fire a NOTIFY. An external daemon would be listening to that
>> notification, and send the email from the data in the table, which it
>> can subsequently delete or mark as used.
>>
>> This is also better because you have a chance to retry if your SMTP is
>> down or whatever. If you fail to send the mail in a trigger or
>> function, you have no way to wait 10 minutes without clogging your
>> application.
>>
>>
> I wouldn't go so far as to say it's a bad idea(it really depends on what
> you need to do).

It certainly can be a very bad idea. Especially if the client that fires
the process is a web server.

Joshua D. Drake

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate