Обсуждение: Send email from PostgreSQL, may I ?
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
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
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/
Вложения
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.
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
Вложения
> 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
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