472,090 Members | 1,305 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,090 software developers and data experts.

Sending email from PL/pgsql

Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?

Thanks,

--
Alexander Deruwe - ad*****@aqs-carcontrol.be
AQS-CarControl

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #1
6 9268
Alexander Deruwe wrote:
I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?


You can write a postgresql function in C that calls libesmtp to send mails.

http://www.stafford.uklinux.net/libesmtp/

Shridhar
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2
Hello

You can use PgSendMail

http://sourceforge.net/project/showf...group_id=35804

Pavel


On Thu, 30 Oct 2003, Alexander Deruwe wrote:
Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?

Thanks,

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #3
Alexander Deruwe wrote:
Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?


You can do it from pgperl and you can call a pgperl fruntion from pl/pgsql.


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #4
Hi,

Alexander Deruwe schrieb:
Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?


And to make it complete, now that plpython is unrestricted,
you can also use plpythonu for this tasks. Works very well
since this was one of the tests I had to make just after
I got my hands on plpythonu ;-)

For example including query results as attachment appeals to me.

Regards
Tino
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #5
On Thu, 2003-10-30 at 08:11, Tino Wildenhain wrote:
Hi,

Alexander Deruwe schrieb:
Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?


And to make it complete, now that plpython is unrestricted,
you can also use plpythonu for this tasks. Works very well
since this was one of the tests I had to make just after
I got my hands on plpythonu ;-)


Actually you guys left out pltclu which can do it, code can be found in
the cookbook:

http://www.brasileiro.net/postgres/c...?recipe_id=292

Robert Treat
--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #6
Tino Wildenhain wrote:
Hi,

Alexander Deruwe schrieb:
Hey,

I was wondering if it is possible to send email from within PL/pgsql.
I'd like to do this to avoid code duplication in multiple frontends.
Can this be done somehow? Or do I have to write a C function for this
purpose? If so, how does one go about that?


And to make it complete, now that plpython is unrestricted,
you can also use plpythonu for this tasks. Works very well
since this was one of the tests I had to make just after
I got my hands on plpythonu ;-)


Complete? You forgot PL/TclU at least ;-)
Jan

--
#================================================= =====================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================= = Ja******@Yahoo.com #
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Hema Sekhar | last post: by
11 posts views Thread by Daniel E. Fisher | last post: by
reply views Thread by Phil Endecott | last post: by
7 posts views Thread by snpe | last post: by
reply views Thread by Matt | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.